Rate This Document
Findability
Accuracy
Completeness
Readability

Example of a YAML Configuration File

A YAML configuration file is used to specify OceanBase configurations during the OceanBase deployment.

This document provides examples of YAML configuration files for deploying OceanBase in the following two scenarios, which are for reference only.

Ensure that the latency between OBServer and OBProxy is low to prevent connection failures between servers (or between servers and proxies) during cluster startup.

  • Scenario 1: There are four servers. Deploy OBProxy on one server, and OBServer on the other three servers. For details about how to deploy OBServer, see Deploying and Starting OceanBase in the OceanBase Deployment Guide. The YAML configuration file is as follows:
    user:
      username: XXX      # User name of the OBServer server. Set this parameter based on the actual situation.
      password: XXX      # User password of the OBServer server. Set this parameter based on the actual situation.
    oceanbase-ce: # OBServer configuration information
      servers:
        - name: server1    # Server name
          ip: 192.168.0.216    # Server IP address
        - name: server2
          ip: 192.168.0.214
        - name: server3
          ip: 192.168.0.212
      global:    # Global parameters
        memory_limit: 300G # Maximum memory that can be occupied by OBServer
        system_memory: 30G # Memory allocated to the default tenant
        datafile_size: 300G # Maximum size of the data file
        log_disk_size: 300G # Maximum size of the log file
        enable_syslog_wf: false 
        enable_syslog_recycle: true 
        max_syslog_file_count: 4 
        skip_proxy_sys_private_check: true
        enable_strict_kernel_release: false
        cpu_count: 128  # Maximum number of CPUs that can be occupied by OBServer
      server1: # Server list
        devname: enp5s0 # NIC name
        mysql_port: 2881 # OceanBase external port
        rpc_port: 2882 # OceanBase internal port
        home_path: /sata/1108    # OceanBase work path. Change it as required.
        data_dir: /sata/1102/data # Data file directory. Change it as required.
        redo_dir: /sata/1102/redo # Log file directory. Change it as required.
        zone: zone1
      server2:
        devname: enp5s0
        mysql_port: 2881 
        rpc_port: 2882 
        home_path: /sata/1108
        data_dir: /sata/1102/data
        redo_dir: /sata/1102/redo
        zone: zone2
      server3:
        devname: enp3s0
        mysql_port: 2881 
        rpc_port: 2882 
        home_path: /sata/1108
        data_dir: /sata/1102/data
        redo_dir: /sata/1102/redo
        zone: zone3
    obproxy-ce: # OBProxy configuration
      depends:
        - oceanbase-ce
      servers:
        - 192.168.0.210  # Proxy service IP address
      global:
        listen_port: 2883 # Proxy external port
        prometheus_listen_port: 2884 # Proxy internal port
        home_path: /home/1108obproxy # Proxy work path. Change it as required.
        enable_cluster_checkout: false
        enable_compression_protocol: false
        skip_proxy_sys_private_check: true
        enable_strict_kernel_release: false
  • Scenario 2: There are four servers. Deploy only HAProxy (for deployment details, see Deploying HAProxy in this document) on one server, and OBServer and OBProxy on the other three servers. The YAML configuration file is as follows:
    user:
      username: XXX      # Username of the OBServer server 
      password: XXX      # Password for logging in to the OBServer server
    oceanbase-ce: # OBServer configuration information
      servers:
        - name: server1    # Server name
          ip: 192.168.0.216    # Server IP address
        - name: server2
          ip: 192.168.0.214
        - name: server3
          ip: 192.168.0.212
      global:    # Global parameters
        memory_limit: 300G # Maximum memory that can be occupied by OBServer
        system_memory: 30G # Memory allocated to the default tenant
        datafile_size: 300G # Maximum size of the data file
        log_disk_size: 300G # Maximum size of the log file
        enable_syslog_wf: false 
        enable_syslog_recycle: true 
        max_syslog_file_count: 4 
        skip_proxy_sys_private_check: true
        enable_strict_kernel_release: false
        cpu_count: 128  # Maximum number of CPUs that can be occupied by OBServer
      server1: # Server list
        devname: enp5s0 # NIC name
        mysql_port: 2881 # OceanBase external port
        rpc_port: 2882 # OceanBase internal port
        home_path: /sata/1108    # OceanBase work path. Change it as required.
        data_dir: /sata/1102/data # Data file directory. Change it as required.
        redo_dir: /sata/1102/redo # Log file directory. Change it as required.
        zone: zone1
      server2:
        devname: enp5s0
        mysql_port: 2881 
        rpc_port: 2882 
        home_path: /sata/1108
        data_dir: /sata/1102/data
        redo_dir: /sata/1102/redo
        zone: zone2
      server3:
        devname: enp3s0
        mysql_port: 2881 
        rpc_port: 2882 
        home_path: /sata/1108
        data_dir: /sata/1102/data
        redo_dir: /sata/1102/redo
        zone: zone3
    obproxy-ce: # OBProxy configuration
      depends:
        - oceanbase-ce
      servers:
        - name: server1 # Proxy server name
          ip: 192.168.0.216 # Proxy service IP address
        - name: server2
          ip: 192.168.0.214
        - name: server3
          ip: 192.168.0.212
      global:
        listen_port: 2883 # Proxy external port
        prometheus_listen_port: 2884  # Proxy internal port
        home_path: /home/1108obproxy # Proxy work path. Change it as required.
        enable_cluster_checkout: false
        enable_compression_protocol: false
        skip_proxy_sys_private_check: true
        enable_strict_kernel_release: false

Deploying HAProxy

This section describes how to deploy HAProxy in scenario 2. This example describes the HAProxy configuration on the server whose IP address is 192.168.0.210.

  1. Install HAProxy.
    yum install haproxy
  2. Modify the HAProxy configuration file.
    1. Open the file.
      vi /etc/haproxy/haproxy.cfg
    2. Press i to enter the insert mode and modify the configuration file as follows:
      global
          log         127.0.0.1 local0 
          chroot      /var/lib/haproxy
          pidfile     /var/run/haproxy.pid
          user        root
          group       root
          daemon
          maxconn     4000
          nbthread    48
      defaults
          log                     global
          retries                 3
          timeout connect         2s
          timeout client          30000s   # Timeout interval for the inactive connection, that is, the time from client connection to HAProxy to the completion of data transmission
          timeout server          30000s   # Timeout interval for inactive connections on the server
      listen obcluster   # Configure database load balancing.
          bind 0.0.0.0:80   # Floating IP address and listening port
          mode tcp    # HAProxy uses the fourth layer of the transport layer.
          balance leastconn # The server with the least connections receives connections first. It is recommended that leastconn is used for long-session services, such as LDAP, SQL, and TSE, instead of short-session protocols, such as HTTP. This algorithm is dynamic. For servers that start slowly, the server weight is adjusted during running.
          server  obproxy-1 192.168.0.216:2883 check inter 2000 rise 2 fall 3 # Check port 2883 every 2,000 ms. If two checks are successful, the server is available. If three checks fail, the server is unavailable.
          server  obproxy-2 192.168.0.214:2883 check inter 2000 rise 2 fall 3
          server  obproxy-3 192.168.0.212:2883 check inter 2000 rise 2 fall 3
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. Start the HAProxy service.
    service haproxy start
  4. Check the HAProxy service status.
    service haproxy status

    If active (running) is displayed, the HAProxy service is started.