How does Zookeeper synchronize the clock in the cluster

有些话、适合烂在心里 提交于 2019-12-10 18:46:09

问题


From the Zookeeper docs:

ctime The time in milliseconds from epoch when this znode was created.

mtime The time in milliseconds from epoch when this znode was last modified.

I presume that Zookeeper somehow syncs the (internal) real clock of all the nodes in the ZK cluster in order the time stamps to be consistent regardless of the node where the client connects. Is that so? If yes, how does it work?

All I found is:

Real time

ZooKeeper doesn't use real time, or clock time, at all except to put timestamps into the stat structure on znode creation and znode modification.

That is, it uses logical time whenever it's possible, but it doesn't say if real clock is synced or not.

Thanks!


回答1:


No, the real clock is only used in ctime and mtime. The current leader used the real clock to set a TxnHeader in the request, and then used as the ctime and mtime of zNode.



来源:https://stackoverflow.com/questions/19554377/how-does-zookeeper-synchronize-the-clock-in-the-cluster

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!