简体   繁体   English

Cassandra 在数据库中写入数据时从哪里花费时间进行 WRITETIME?

[英]From where Cassandra takes time for WRITETIME when it is writing data in the database?

When Cassandra is writing data to the database it is writing it with the WRITETIME.当 Cassandra 将数据写入数据库时,它使用 WRITETIME 写入数据。 My question is will that time be from the servers where Cassandra is running or from the servers where the application that is writing data to Cassandra is running?我的问题是,时间是来自正在运行 Cassandra 的服务器,还是来自正在向 Cassandra 写入数据的应用程序正在运行的服务器?

The background is that we have a problem with writetime some data was written with WRITETIME in the future (07-02-2036) which implies that something is wrong with NTP maybe, but it is not clear which machines are causing the problem Cassandra servers or application servers.背景是我们的 writetime 有问题,一些数据在未来(07-02-2036)用 WRITETIME 写入,这意味着 NTP 可能有问题,但不清楚是哪些机器导致问题 Cassandra 服务器或应用服务器。

It depends on the version of driver that is used in your applications.这取决于您的应用程序中使用的驱动程序版本。 For a long time, writetime was the server time, but at some point the switch happened and the write time started to be sent by drivers (it was introduced in version 3 of Cassandra native protocol).很长一段时间,writetime都是服务器时间,但在某个时刻发生了切换,写入时间开始由驱动程序发送(在Cassandra原生协议版本3中引入)。 As result of that, you need to have NTP running on both Cassandra & application nodes.因此,您需要在 Cassandra 和应用程序节点上运行 NTP。

For Java driver it's by default starting with version 3.0 , for other drivers it should be similar, around the same time (~2016th).对于 Java 驱动程序,默认情况下从版本 3.0开始,对于其他驱动程序,它应该是相似的,大约在同一时间(~2016 年)。 From java driver docs:来自 java 驱动程序文档:

Client-side generation: This is enabled by default if you're using the driver 3.0+ and a version of Cassandra that supports native protocol v3 or above.客户端生成:如果您使用驱动程序 3.0+ 和支持本机协议 v3 或更高版本的 Cassandra 版本,则默认启用此功能。

But writetime could be also set explicitly, so you may also check if your applications are doing that.但是 writetime 也可以显式设置,因此您还可以检查您的应用程序是否正在这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM