Network Time Protocol (NTP) synchronizes clocks between computer systems through the network. The NTP server keeps the clocks of all servers in an organization synchronized.
OceanBase Database is a distributed database. Therefore, the clocks of servers in a cluster and OceanBase Cloud Platform (OCP) servers must be configured with a clock synchronization service, either NTP or Chrony, to ensure that the clock offset of all servers is within 2 s.
The system time of servers running OBServer is synchronized by NTP. However, when the time difference is too large, NTP does not change or correct the system time. If the cluster time is not synchronized, cluster availability will be affected. This topic describes how to adjust the system time of an OBServer node.
How to check NTP offset
You can check the NTP offset in the following ways:
View the NTP offset on the host
Run the following command to check the clock offset:
[root@hostname /]# ntpq -p|grep -E "\*|\=|remote"
remote refid st t when poll reach delay offset jitter
==========================================================================
xxxxxxxxxxx xxxxx 2 u 16 64 377 1.333 0.046 0.033
Set the NTP offset
Offset threshold
If the NTP offset exceeds 2 seconds, you must adjust it.
When the OBServer node's system time is slower than the standard time
If an OBServer node's system time is behind the standard time, you can directly update the server's system time to match the standard time. For example, if the standard time is 20:00 and the OBServer time is 19:00 (one hour behind):
Stop the OBServer.
Once the OBServer is stopped, SSH to the host and manually change the system time.
Here,
ntp_server_ipis the IP address of the NTP server.[root@hostname /]# ntpdate <ntp_server_ip>Start the OBServer.
When the OBServer node's system time is faster than the standard time
If an OBServer node's system time is ahead of the standard time, you should not directly roll back the system time. Instead, stop OBServer and wait until the standard time catches up before making any adjustments. For example, if the standard time is 20:00 and the OBServer time is 21:00 (one hour ahead):
Stop the OBServer.
After the process stops, wait until the standard time exceeds 21:00 (for example, when standard time is 21:05). Then log in to the host by using SSH and manually change the system time.
Here,
ntp_server_ipis the IP address of the NTP server.[root@hostname /]# ntpdate ntp_server_ipStart the OBServer.