tyrant互为主备时同步日志异常的问题

    使用两台tyrant互为主备的时候,就算我不保存对象到tyrant,同步日志都一直不断增加,1小时之内就能达到1G,而数据文件还不到1M。

    原因基本查明:两台Linux虚拟机的时间同步所引起的。原先同步时间的方法是把ntpdate放到cron中,几分钟自动同步一次。但是ntpdate会引起时钟的跃变,而tyrant的主备同步,应该基于一项基本的假设,即系统时间是线性的,时间不会往回跳跃。

   解决方法是使用ntpd来校准时钟,而不是调整计算机时钟上的时间。ntpd使用时也需要加上-x参数,文档中是这么描述这个参数的:

-x      Normally,  the  time  is  slewed  if  the  offset is less than the step threshold, which is 128 ms by default, and
               stepped if above the threshold. This option forces the time to be slewed in all cases. If the  step  threshold  is
               set to zero, all offsets are stepped, regardless of value and regardless of the -x option. In general, this is not
               a good idea, as it bypasses the clock state machine which is designed to cope with large time and frequency errors
               Note:  Since  the slew rate is limited to 0.5 ms/s, each second of adjustment requires an amortization interval of
               2000 s. Thus, an adjustment of many seconds can take hours or days to amortize. This option can be used  with  the
               -q  option.

你可能感兴趣的:(linux,虚拟机,idea)