如何更改Apache Cassandra的默认时区? [英] How can I change Apache Cassandra's default time zone?

查看:1965
本文介绍了如何更改Apache Cassandra的默认时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Windows上运行Cassandra实例...不要问为什么...

I need to run a Cassandra instance on Windows... Don't ask why...

无论如何,问题是我有时间戳列datetime在PST时区,但我想查看GMT时区。我的机器运行与BST时区(英国夏令时)。

Anyway the issue is that I have time stamp columns that show datetime in PST time zone but I would like to see GMT time zone. My machine runs with BST time zone(British Summer Time).

有没有办法将默认时区更改为GMT?

Is there a way for me to change the default time zone to GMT?

推荐答案

时间戳记值独立于从其转换的时区存储。 TZ的任何表示将由cqlsh完成,它依赖于Python,用于从TZ不可知时间戳值到cqlsh输出的转换。 Python又会使用操作系统默认的TZ。在Linux中,您可以通过在用于启动cqlsh的同一shell中设置以下环境变量来更改TZ: export TZ ='GMT'。我想这应该适用于Windows,以及使用类似 set TZ ='GMT'

Timestamp values are stored independently from the timezone they have been converted from. Any representation of a TZ will be done by the cqlsh which is depending on Python for the conversion from the TZ agnostic timestamp value to the cqlsh output. Python in turn will use the OS default TZ. In Linux, you can change the TZ by setting the following environment variable in the same shell used to start cqlsh: export TZ='GMT'. I suppose this should work for Windows as well using something like set TZ='GMT'.

更新11/2月/ 2016年:描述的行为将不再工作2.1+。有关详情,请参见此答案

Update 11/Feb/2016: described behaviour will not work anymore for 2.1+. See this answer for details.

这篇关于如何更改Apache Cassandra的默认时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆