OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.6.0

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.6.0
    iconOceanBase Database
    SQL - V 4.6.0
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    (Optional) Configure the clock source

    Last Updated:2026-05-07 11:26:25  Updated
    Share
    What is on this page
    Prerequisites
    Procedure

    folded

    Share

    OceanBase products are implicitly correlated to each other in time. Therefore, the physical time on all servers of OceanBase products must be synchronized with a latency of no more than 2s. Therefore, the Network Time Protocol (NTP) service or chrony service must be configured for the clocks of nodes in the cluster and the OceanBase Cloud Platform (OCP) node to ensure a clock offset of no more than 2s for all nodes. This topic describes how to configure an NTP clock source for multiple servers in a cluster.

    You do not need to configure an NTP clock source for a standalone OceanBase database.

    Prerequisites

    You have the root user permissions on all servers.

    Procedure

    Perform the following steps to configure the NTP clock source.

    Note

    Generally, the built-in NTP service of Linux can be used for time synchronization. If the current environment has a stable and reliable NTP server, this NTP server is used as the NTP source of all servers. If no such NTP server is available, a fixed server is selected as the NTP source.

    1. Install the NTP source on each server by using the YUM package manager.

      [root@xxx /]# yum install ntp ntpdate -y
      
    2. Configure the ntp.conf file.

      [root@xxx /]# vi /etc/ntp.conf
      restrict default ignore
      restrict 127.0.0.1
      restrict 192.168.0.0 mask 255.255.0.0
      
      driftfile /var/lib/ntp/drift
      pidfile /var/run/ntpd.pid
      #logfile /var/log/ntp.log
      
      # local clock
      server 127.127.1.0
      fudge 127.127.1.0 stratum 10
      
      server 192.168.XX.XX iburst minpoll 4 maxpoll 6
      

      where

      • restrict specifies the privileges of time synchronization commands related to the IP address.

        restrict [IP] mask [netmask_IP] [parameter]
        

        Valid values of parameter are ignore, nomodify, noquery, notrap, and notrust. Here, ignore specifies to reject all types of NTP synchronization by default.

      • server specifies the upper-level NTP source server.

        server [IP or hostname] [prefer]
        

        If no upper-level NTP source server is available, the server parameter can be set to 127.127.1.0, which means that the local server is used as the NTP source server.

    3. Restart the NTP synchronization service.

      [root@xxx /]# systemctl restart ntpd
      [root@xxx /]# systemctl status ntpd
      
    4. Check the NTP synchronization status.

      Note

      If the NTP service has just been started, you need to wait for a moment before running the ntpstat command.

      [root@xxx /]# ntpstat
      [root@xxx /]# ntpq
      remote          refid       st  t  when  poll reach delay offset jitter
      ========================================================================
      LOCAL(0)        .LOCL.      10  l  589   64   0     0.000 0.000  0.000
      *192.168.XX.XX  xxx.xxx.xxx.xxx  2   u  18    64   377   1.591 0.249  0.054
      

      Parameters in the result of the ntpq command are described as follows:

      • remote: indicates the NTP server used. * indicates the current NTP server. LOCAL indicates that the local server is used as the NTP server. x indicates that the NTP server is no longer used. - indicates that the NTP server is no longer used. + indicates that the NTP server is in good condition and is preferred. # indicates that the NTP server is in good condition but is not used.
      • refid: indicates the higher-level NTP server used by the remote NTP server. INIT indicates that the higher-level NTP server is being obtained.
      • st: indicates the stratum of the remote NTP server.
      • when: indicates the period from the last synchronization to the current time, in seconds by default. h indicates hour and d indicates day.
      • poll: indicates the synchronization frequency, in seconds.
      • delay: indicates the roundabout time from the local server to the remote NTP server, in milliseconds.
      • offset: indicates the time offset between the local server and the remote NTP server, in milliseconds.
      • jitter: indicates the average deviation in the time offset between the local server and the remote NTP server, in milliseconds.
    5. Conduct final check.

      The following example is for your reference to conduct the final synchronization latency check:

      [root@xxx /]# clockdiff 192.168.XX.XX
      ..................................................
      host=192.168.XX.XX rtt=1(0)ms/1ms delta=0ms/0ms Sat Apr 18 14:41:40 2020
      
    6. (Optional) Perform manual synchronization.

      If the time deviation is always great, you can use the ntpdate command to manually correct the time. This conflicts with the automatic synchronization service. Therefore, before you manually correct the time, you need to stop the NTP service first.

      [root@xxx /]# systemctl stop ntpd
      [root@xxx /]# ntpdate -u 192.168.XX.XX
      18 Apr 14:54:20 ntpdate[108001]: adjust time server 192.168.XX.XX offset -0.000180 sec
      

      If this method is effective, you can configure it in crontab of the system.

      [root@xxx /]# crontab -e
      * * * * * /sbin/ntpdate -u 192.168.XX.XX 2>&1 1>>/tmp/ntpupdate.log
      
    7. (Optional) Configure the firewall rule.

      In a standard environment, the firewall needs to be disabled. If the firewall must be enabled in a server environment, comply with the following rule:

      [root@xxx /]# iptables --A INPUT --p udp --i eth0 --s 192.168.1.0/16 --dport 123 --j ACCEPT
      [root@xxx /]# systemctl restart ntpd
      

    Previous topic

    Initialize an OBServer node by using oatcli
    Last

    Next topic

    Deploy a two-replica OceanBase cluster with the arbitration service by using the CLI
    Next
    What is on this page
    Prerequisites
    Procedure