Apache Cassandra时区问题

时间:2017-01-04 07:02:36

标签: apache datetime hadoop cassandra datastax

我正在尝试使用人才将数据从MSSQL移动到 cassandra 但是我得到了时区问题,因为MSST在CST时区,而Cassandra有时区Etc / UTC。

尝试更改以下配置文件

Location: /opt/apache-cassandra-3.9/conf/

档案:cqlshrc.sample

更改自: timezone = Etc / UTC to:timezone = CST

但是cqlsh仍显示UTC时间戳

cqlsh>  select toTimestamp(now()) from system.local;

system.totimestamp(system.now())

2017-01-04 06:38:45.645000+0000

我正在使用apache cassandra 3.9

所以请有人帮助我继续这个。

1 个答案:

答案 0 :(得分:2)

您是否安装了pytz模块?启动cqlsh时可能错过了以下警告:

[me@centos bin]$ ./cqlsh
Warning: Timezone defined and 'pytz' module for timezone conversion not installed. Timestamps will be displayed in UTC timezone.

此外,您可能需要以区域/位置格式指定时区。试着给America/Chicago一个去吧。

无论哪种方式,这只是关于时间戳的显示。 Cassandra不会存储任何带有日期/时间戳的时区信息。它们始终以UTC格式存储。

相关问题