hbase/hypertable集群启动需要进行时间同步原因?

下面是一些讨论想法:

-------------------------------------------------------------------------------------------------------------------------------------------------

是不是和timestamp有关

Hbase默认的是30s这个时间差,对于时间戳已经太大了

rangeserver上有关skew有这段注释:

HT_ERROR("Revision (clock) skew detected! May result in data loss.");
是不是每个网络通信都有一个timer消息啊,为了统一这个timer的时间,所以规定了时间间隔啊。

还有会不会是因为异步通信的超时时间设置的问题,超时时间设置为30s 如果一台机器的时间总是比另一台慢30多秒,那他们俩根本无法通信啊。。

It's important to set up NTP to synch clocks within a few milliseconds across hosts. Of course they will never be exactly in sync, but there is no reason that would be necessary.
The only time clock synch comes into play is if a region migrates from one server to another. If the new RS is significantly behind the first RS, new writes will be shadowed by old writes. But since region migration takes upwards of a second, this isn't a problem when you run NTP.
New versions of HBase actually check clock synch is within a reasonable interval when you start the servers.


看不懂。。。我查了rangeserver确实是只有在迁移时判断是否时间是否偏移

迁移的时候是不是要把缓存的东西也迁过去?如果这样,一台时钟慢得机器里面的缓存里的新的吸入数据可能会那一台时间快的中旧的写入数据给覆盖?

迁移的时候应该是吧memtable中的数据刷新到文件中才进行迁移的 否则数据就丢失了 

迁移前缓存数据就写到dfs了,另一台机器为什么会覆盖,管理的range也不一样

就算写到DFS了,那时间戳总是不变的吧

哦,我明白你意思了
迁移过去以后有可能覆盖是吧

然后时间快的机器读取这个range   查询这个range事缓存里的数据虽然旧但是时间上比文件系统中的新,然后覆盖了,
旧数据变成新数据了。

But since region migration takes upwards of a second, this isn't a problem when you run NTP
只要将NTP中时间设置比传输时间小就能保证不被覆盖了

只要将NTP中时间设置比传输时间小就能保证不被覆盖了  是上面那句英文的翻译?

恩 应该是 

不是,我自己理解的,因为传输要用一定时间,等迁移过去以后,new RS开始接收数据,这时new RS接收数据的时间戳比迁移range中得新就不会出现覆盖。

超过一秒就行了把 如果迁移的时候。。
要不我们这个系统 在迁移时,不支持写呗。

When clocks are significantly out-of-skew (e.g. several seconds), old results can suddenly appear in a query, or worse, when the system is brought down and back up again, data can go missing. In almost all circumstances, the system will detect clock skew and either refuse updates by throwing an exception up to the application, 
or will log an error message in the range server log file

range传输的时间要比ntp的时间长

我觉得ntp的意义在于保证迁移range中最新的时间戳,在经过传输时间后,不会比new RS时间新

恩 对 

可是默认设置是30秒。。。

????
-------------------------------------------------------------------------------------------------------------------------------------------------
最后讨论的结果如下:
这里假设一个range从rs1到rs2,并且rs1当前时间是6:00,rs2的当前时间是5:00,并且rs1上在5:59的时候写入数据<k1, v1, 5:59>,之后该range迁移到了rs2了,并且rs2已经能够向外界提供服务了,在5:10来了个对k1的修改请求,将k1对应的值改成v2,这时rs2将写入<k1, v2, 5:10>。
这时如果来了对k1的查询请求的话,rs2将返回<k1, v1>,但实际上这已经是旧的数据了。
所以整个集群中需要使用ntp来保证集群机器时间的相对一致性。但是这里还是存在一个问题,是hbase中设置的时间差值非常大,默认是30s,这个是不是可能存在问题,忘高人解答?
posted @ 2011-12-14 11:11  qiang.xu  阅读(2797)  评论(0编辑  收藏  举报