Rate This Document
Findability
Accuracy
Completeness
Readability

Deploying and Starting OceanBase

After installing OceanBase using the all-in-one installation package, follow the procedure in this section and use the cluster configuration file to deploy and start the OceanBase cluster. Before starting the OceanBase cluster, ensure that NTP is installed and configured.

  1. Create and modify a YAML configuration file.
    1. Create a YAML configuration file. distributed-example.yaml is the name of the cluster configuration file. Change it as required.
      vi distributed-example.yaml
    2. Press i to enter the insert mode. Refer to the configuration file template in the /oceanbase-all-in-one/obd/usr/obd/example folder and modify the YAML configuration file as required. For details about the YAML configuration file example, see Example of a YAML Configuration File.
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  2. Use the YAML configuration file to deploy OceanBase.
    cd /oceanbase-all-in-one/obd/usr/obd/example
    obd cluster deploy obcluster -c distributed-example.yaml

    Modify the following parameters as required:

    • obcluster indicates the cluster name.
    • distributed-example.yaml is the name of the cluster configuration file.
  3. Install and configure the NTP service.
    1. Install NTP on all clusters and NTP client nodes.
      1
      yum -y install ntp ntpdate
      

    2. Back up the existing configuration on all clusters and NTP client nodes.
      1
      cd /etc && mv ntp.conf ntp.conf.bak
      
    3. Select a server as the NTP server node, and create and configure an NTP file on the server. In this example, the server whose IP address is 192.168.0.216 is the NTP server node.
      1. Create a file.
        1
        vi /etc/ntp.conf
        
      2. Press i to enter the insert mode and add the following content to the file as the NTP server:
        1
        2
        3
        4
        5
        restrict 127.0.0.1
        restrict ::1
        restrict 192.168.0.216 mask 255.255.255.0
        server 127.127.1.0
        fudge 127.127.1.0 stratum 8
        

        In the preceding content, restrict 192.168.0.216 mask 255.255.255.0 indicates the network segment and mask of the NTP server. Replace them with the actual ones.

      3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Create NTP files on all other client nodes.
      1. Open the file.
        1
        vi /etc/ntp.conf
        
      2. Press i to enter the insert mode and add the following content to the file as the client node:
        1
        server 192.168.0.216
        
      3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Start and synchronize the NTP service.
    1. On the NTP server node whose IP address is 192.168.0.216, start the NTP service and view the service status.
      1
      2
      3
      systemctl start ntpd
      systemctl enable ntpd
      systemctl status ntpd
      

    2. Forcibly synchronize the time of the NTP server node whose IP address is 192.168.0.216 to all other NTP client nodes.
      1
      ntpdate 192.168.0.216
      
    3. Write the hardware clock to all nodes except the 192.168.0.216 server node to prevent synchronization failure after the server is restarted.
      1
      hwclock -w
      
    4. Install and start the crontab tool on all nodes except the 192.168.0.216 server node.
      1
      2
      3
      4
      yum install -y crontabs
      chkconfig crond on
      systemctl start crond
      crontab -e
      

      Run the crontab -e command to open the crontab file of the current user for editing scheduled tasks.

    5. Add the following content to the crontab file to enable automatic time synchronization with the 192.168.0.216 server node every 10 minutes:
      1
      */10 * * * * /usr/sbin/ntpdate 192.168.0.216
      
    6. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. Start the OceanBase cluster.
    1
    obd cluster start obcluster
    
    • obcluster indicates the cluster name. Replace it with the actual one.
    • For initial deployment of the cluster, the commands in this step will perform the cluster initialization, including creating system catalogs and system tenants. For non-initial deployment, the commands in this step will start the OceanBase cluster.
  6. Check the observer process to ensure that the OceanBase cluster is started.
    ps -aux | grep observer

    Expected result:

  7. Use OBClient to connect to OceanBase.
    obclient -h127.0.0.1 -P2883 -uroot -Doceanbase -A

    Modify the following parameters as required:

    • 127.0.0.1 and 2883 are the IP address and port number of the OceanBase server respectively.
    • root is the database user, and sysbench_tenant is the database tenant.
    • oceanbase is the name of the OceanBase database.
  8. Optional: Stop the cluster.
    obd cluster stop obcluster 

    obcluster indicates the cluster name. Replace it with the actual one.

  9. Optional: Check the cluster status.
    obd cluster display obcluster 

    obcluster indicates the cluster name. Replace it with the actual one.

  10. Optional: Check the cluster list.
    obd cluster list