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.2.1

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive 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.2.1
    iconOceanBase Database
    SQL - V 4.2.1
    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-04-28 09:23:26  Updated
    Share
    What is on this page
    Prerequisites
    Procedure

    folded

    Share

    This topic describes how to configure the Network Time Protocol (NTP) clock source for servers in a cluster. If you are planning to deploy OceanBase Database on a single server, or for personal testing purposes, or if you have already configured NTP clock synchronization, skip this step.

    However, if you plan to deploy a distributed OceanBase cluster, it is necessary to ensure time synchronization among all servers in the cluster. Otherwise, the cluster will not be able to start, and the services may encounter exceptions during runtime. The allowed clock deviation in the OceanBase cluster should not exceed 2 seconds. If the deviation exceeds 2 seconds, the cluster may become leaderless. To restore it to normal, you will need to restore clock synchronization and restart the OceanBase cluster.

    Note

    • Starting from V4.1.0, OceanBase Database supports dynamic modification of clocks without impacting data accuracy and stable cluster operation.

    • If the nodes for deploying OCP Express or OCP are different from that for deploying the OceanBase cluster, you need to synchronize the clock source between the OCP Express or OCP nodes and the OceanBase cluster nodes. This prevents operational exceptions in OCP Express or OCP due to clock deviations.

    Prerequisites

    You have the root user privileges on all nodes.

    Procedure

    Perform the following steps to configure the NTP clock source.

    1. Run the following command on each server to install NTP:

      yum install ntp ntpdate -y
      
    2. Run the following command to check the NTP connection to the server:

      [root@centos-01 ~]# ntpq -4p
      remote refid st t when poll reach delay offset jitter
      ==============================================================================
      *time6.aliyun.co xxx.xxx.xxx.xxx 2 u 712 1024 377 21.951 4.253 4.208
      
    3. (Optional) Enable the NTP service.

      If you already have an NTP server, skip this step. The following example describes how to enable time synchronization by taking the server 10.10.10.1 as the NTP server.

      1. Edit the configuration file.

        Log on to the NTP server as the root user and run the following command to edit the configuration file:

        vi /etc/ntp.conf
        

        Add the following content to the configuration file:

        server <your_ntp_server_ip>
        

        Save and close the file.

      2. Run the following command to restart the NTP service:

        service ntpd restart
        
      3. Run the following command to check whether the NTP service is enabled:

        ps -ef | grep -i ntpd
        
      4. Run the following command to enable the NTP service upon startup.

        chkconfig ntpd on
        
    4. Enable the NTP service.

      Note

      You can enable the NTP service 5 minutes after the NTP server is started. Otherwise, the system prompts "no server suitable for synchronization found".

      1. Log on to OceanBase Database as the root user.

      2. Run the following command to stop the NTP service:

        service ntpd stop
        
      3. Run the following command to synchronize the time with the NTP server:

        ntpdate 10.10.10.1
        
      4. Edit the configuration file.

        Run the following command to open the configuration file:

        vi /etc/ntp.conf
        

        Add the following content to the configuration file:

        server <your_ntp_server_ip>
        
      5. Run the following command to start the NTP service:

        /etc/init.d/ntpd start
        
    5. Verify that the configuration is successful.

      Run the following command:

      ntpstat
      

      The following output is returned:

      synchronised to NTP server (xxx.xxx.xxx.xxx) at stratum 3
      time correct to within 2 ms
      polling server every 64 s
      

      Run the following command:

      timedatectl
      

      The following output is returned:

            Local time: Thu 2021-04-22 11:02:32 CST
        Universal time: Thu 2021-04-22 03:02:32 UTC
              RTC time: Thu 2021-04-22 11:02:32
             Time zone: Asia/Shanghai (CST, +0800)
           NTP enabled: yes
      NTP synchronized: yes
       RTC in local TZ: yes
            DST active: n/a
      

      The outputs above indicate that the NTP service takes effect.

    Previous topic

    (Optional) Set password-free SSH logon
    Last

    Next topic

    (Optional) Perform disk planning
    Next
    What is on this page
    Prerequisites
    Procedure