This topic describes how to deploy an OceanBase cluster on a single server by using obd. The operation examples are provided for your reference only and are not recommended for production environments.
Note
For more information about how to deploy an OceanBase cluster by using obd in the GUI, see Deploy an OceanBase cluster by using obd in the GUI.
Prerequisites
Before you start, make sure that you meet the following conditions:
To deploy only OceanBase Database, you need at least 2 vCPU cores, 6 GB of memory, and 20 GB of disk space. Note that the memory limit refers to the value in the
availablecolumn of the output of thefree -gcommand.The data directory and log directory must be at least twice the memory size of OceanBase Database. We recommend that you set the size to three times the memory size. Before deployment, check whether the planned directories meet the specifications and ensure that the deployment user has the execute and read/write permissions for the planned directories.
Note
In an environment with a small number of CPU cores, the minimum CPU_Count set by default by obd is 8. A low CPU core count will negatively impact the performance of OceanBase Database.
If you deploy OceanBase Database on an x86 server, make sure that the OBServer node supports the AVX instruction set. You can execute the
lscpu | grep Flags | grep avxcommand to check whether the AVX instruction set is supported.Note
If you deploy OceanBase Database on an x86 server, the AVX instruction set is not required for the following versions of OceanBase Database:
- V4.2.5.6 and later for V4.2.x.
- V4.3.5.4 and later for V4.3.x.
- V4.4.1.0 and later for V4.4.x.
In an offline deployment scenario, if you deploy OceanBase Database on an ARM server, make sure that the OBServer node supports the LSE instruction set. You can execute the
lscpu | grep Flags | grep atomicscommand to check whether the LSE instruction set is supported. If the LSE instruction set is not supported, you need to download the OceanBase Database installation package with thenonlseparameter and use theobd mirror clonecommand to upload the installation package to the local image repository of obd.Note
The OceanBase Database installation package with the
nonlseparameter is not provided in the OceanBase All in One package.If you want to modify the kernel parameters of the server, the deployment user must have the sudo privilege.
You have installed obd. To deploy OceanBase Database interactively, the version of obd must be V3.4.0 or later. We recommend that you install the latest version. For more information, see Install obd.
The deployment image repository of obd contains the installation packages of the required components, such as OceanBase Database and ODP.
If the server where obd is installed can connect to the Internet, the required components will be automatically downloaded from the remote image repository. If you plan to deploy OceanBase Database Enterprise Edition, contact Technical Support to obtain the installation package and execute the
obd mirror clonecommand to upload the installation package to the local image repository of obd. After the installation package is uploaded, you can execute theobd mirror list localcommand to view the installation packages in the local image repository.Note
By default, the remote image repository is disabled after you install obd by using the OceanBase All in One package. To access the remote image repository, execute the
obd mirror enable remotecommand.You have installed the OBClient client. For more information, see OBClient documentation.
Note
- If the server cannot connect to the Internet, we recommend that you install obd by using the OceanBase All in One package. The OceanBase All in One package provides all the required components except for the obbinlog component, which has been tested for compatibility with each other.
When you install obd by using the OceanBase All in One package, obd and the OBClient client are automatically installed. Therefore, if you install obd by using the OceanBase All in One package, you can ignore the other conditions except for the resource requirements.
Procedure
Notice
The operations in this topic are performed in an environment based on the x86 architecture of CentOS Linux 7.9. The environment may vary in other cases.
obd supports the deployment of OceanBase Database Community Edition and OceanBase Database Enterprise Edition. This topic describes how to deploy OceanBase Database Community Edition.
You can execute the obd cluster deploy -i command to start the interactive deployment process. In the interactive installation process, you need to configure the following information.
Enter user information
After entering the interactive installation process, you need to enter the IP address and password of the server where OceanBase Database is to be installed and confirm the password of the current user again. The following is an example:
Note
By default, OceanBase Database is deployed in the current user account on the server. Make sure that the server where OceanBase Database is to be installed contains the current user account. For example, if you use the admin user to execute the command to enter the interactive deployment process, the server where OceanBase Database is to be installed must contain the admin user, and the password must be that of the admin user.
Enter the IP (Default: 10.10.10.1): Enter the current user password : ******* Re-enter the current user password : *******If you have configured password-free login for the current user, you can press the
Enterkey to skip this step.Modify kernel parameters
After configuring the node information, if you have not modified the kernel parameters of the target server, obd will obtain the kernel parameters of the node and ask whether you want to modify them. The specific information is as follows:
get system config ok +---------------------------------------------------------------------------------------+ | System Parameter Change List | +---------------+---------------------------------+---------------+---------------------+ | ip | name | current_value | expected_value | +---------------+---------------------------------+---------------+---------------------+ | 10.10.10.1 | fs.aio-max-nr | 65536 | 1048576 | | 10.10.10.1 | net.core.somaxconn | 128 | 2048 | | 10.10.10.1 | net.core.netdev_max_backlog | 1000 | 10000 | | 10.10.10.1 | net.core.rmem_default | 212992 | 16777216 | | 10.10.10.1 | net.core.wmem_default | 212992 | 16777216 | | 10.10.10.1 | net.core.rmem_max | 212992 | 16777216 | | 10.10.10.1 | net.core.wmem_max | 212992 | 16777216 | | 10.10.10.1 | net.ipv4.conf.default.rp_filter | 0 | 1 | | 10.10.10.1 | net.ipv4.tcp_rmem | 6291456 | 4096 87380 16777216 | | 10.10.10.1 | net.ipv4.tcp_wmem | 16384 | 4096 65536 16777216 | | 10.10.10.1 | net.ipv4.tcp_max_syn_backlog | 1024 | 16384 | | 10.10.10.1 | net.ipv4.tcp_fin_timeout | 60 | 15 | | 10.10.10.1 | vm.min_free_kbytes | 67584 | 2097152 | | 10.10.10.1 | fs.file-max | 3175323 | 6573688 | | 10.10.10.1 | fs.pipe-user-pages-soft | 16384 | 0 | | 10.10.10.1 | vm.max_map_count | 65530 | 655360 | | 10.10.10.1 | nofile | 65535 | 655350 | +---------------+---------------------------------+---------------+---------------------+ Please run `obd host user init -u admin --host=10.10.10.1` to init user. Please run `obd host init admin 10.10.10.1` to init host. Do you want to modify the parameters above? [y/n] [Default: y]:You can enter
yornat the above prompt.If you enter
y, the system will start to modify the corresponding kernel parameters and output the following prompt.Note
To modify the kernel parameters, you must have sudo privileges. If you do not have sudo privileges, the modification will fail, but it will not affect the deployment of the cluster.
modify system parameters 10.10.10.1: ( fs.aio-max-nr,net.core.somaxconn,net.core.netdev_max_backlog,net.core.rmem_default,net.core.wmem_default... ) have been successfully modified! Do you want to quit the script and manually restart the machine to apply the optimizations? [y/n] [Default: n]:If you enter
y, the deployment script will exit. If you entern, the deployment process will continue.If you enter
n, the corresponding kernel parameters will not be modified, and the deployment process will continue.
Configure cluster information
You need to set the deployment name, port, password, and resource information of the OceanBase cluster at the corresponding positions. Press the
Enterkey to use the default values. The following is an example:Note
The script automatically obtains the value range and default value of the cluster resource configuration based on the resources of the server. The value range and default value will vary with the resources of the server.
- When you configure the cluster directory, make sure that the deployment user has the execute and read/write permissions on the directory.
# Specifies the cluster name. The cluster name must be 1 to 63 characters in length. It must start with a letter and can contain only letters, digits, and underscores (_). Enter the cluster name (Default: myoceanbase; allowed characters: letters, numbers, and underscores): # Select the type of OceanBase Database to deploy #Displayed only if there is an OceanBase Database installation package for the selected type (Standalone Edition, Enterprise Edition, or Community Edition) in the OBD image repository. Multiple OceanBase packages found in the mirror. Please choose one: 1) oceanbase (Business) 2) oceanbase-ce (Community) 3) oceanbase-standalone (Business) Enter the number of the oceanbase type you want to use: 2 # Set the version of OceanBase Database, defaulting to the latest five OceanBase Database versions in the image repository. +-----------------------------------------------------------------------------------------------------------------------------+ | Available Oceanbase | +--------------+---------+------------------------+--------+------------------------------------------------------------------+ | name | version | release | arch | md5 | +--------------+---------+------------------------+--------+------------------------------------------------------------------+ | oceanbase-ce | 4.3.5.2 | 102010012025052715.el7 | x86_64 | 9a686c637798f0b465acef7be7911e79ef6fe705a23a45679eaa24e5d6bbb2e3 | | oceanbase-ce | 4.3.5.1 | 101020012025061620.el7 | x86_64 | cbca16ad25003e65bafed2455c2e442b9f0563661c7f7eb149b368322e76f4a5 | | oceanbase-ce | 4.3.5.0 | 100000202024123117.el7 | x86_64 | 08314aa05c1993c6df2bf3bfb867ea0df85f2b234c31226524d352d99f781f50 | | oceanbase-ce | 4.3.4.1 | 101000032024121814.el7 | x86_64 | 36006ed8bf531b17892eaf3a9e43d1e4284049d22b54b9b5b8fe656624713573 | | oceanbase-ce | 4.3.4.0 | 100000162024110717.el7 | x86_64 | 3067df2369964aa19f93f1448cf507d0f20df6ea2761120a5adfca3711cd97ff | +--------------+---------+------------------------+--------+------------------------------------------------------------------+ ...... #If you want to install the latest version, enter y to proceed; if you want to install another version, output n and specify the version in the subsequent interaction. Are you sure to deploy using this latest version(4.3.5.2) of Oceanbase.: [y/n] [Default: y]: # Output the OceanBase Database version to be installed. Enter the version of oceanbase-ce you want to use (e.g.: 4.3.5.2): 4.3.5.1 Download oceanbase-ce-4.3.5.1-101020012025061620.el7.x86_64.rpm (161.15 M): 100% [#################] Time: 0:00:12 13.62 MB/s +-----------------------------------------------------------------------------------------------------+ | Available Oceanbase | +--------------+---------+------------------------+--------+------------------------------------------+ | name | version | release | arch | md5 | +--------------+---------+------------------------+--------+------------------------------------------+ | oceanbase-ce | 4.3.5.1 | 101020012025061620.el7 | x86_64 | fe7d924524546c9e0188a36194aa69332933e36c | +--------------+---------+------------------------+--------+------------------------------------------+ # The SQL port for the cluster. Corresponds to mysql_port in the configuration file. Enter the OB SQL port (Default: 2881): # Configure the cluster's RPC port, which corresponds to the rpc_port in the configuration file. Enter the OB RPC port (Default: 2882): # Sets the obshell port for the cluster, corresponding to the obshell_port configuration. Enter the obshell port (Default: 2886): #Set the password for the root@sys user in the cluster. This corresponds to the root_password parameter in the configuration file. If not set, a random string will be generated by default. Enter the OB root password (Default: ************): #Confirm the password of the root@sys user. This step is required only if you manually configure the password. Confirm the OB root password: #The total number of CPU cores available in a cluster. The value of this parameter corresponds to the cpu_count value in the configuration file. #The value cannot be less than 8. When it is less than 8, the system automatically sets the value to 8. If it is not set, OceanBase Database automatically detects it. Enter the OB cpu count (Default: 8): #Set the amount of memory available to the cluster. Corresponds to the memory_limit parameter in the configuration file. Enter the OB memory limit (Configurable Range[6, 28], Default: 28, Unit: G): 12 # The installation directory of OceanBase Database, which is specified by home_path in the configuration file. If not specified, it will create a directory with the same name as the cluster in the user's home directory. Enter the OB installation directory (Default: /home/admin/myoceanbase): # Set the storage directory for storing SSTables, which corresponds to the data_dir parameter in the configuration file. If not specified, the default is /data/1/${cluster_name}. Enter the OB data directory (Default: /data/1/myoceanbase): # Specifies the directory where logs are stored. This corresponds to the redo_dir configuration parameter in the configuration file. If not specified, the default is /data/log1/${cluster_name}. Enter the OB log directory (Default: /data/log1/myoceanbase): #Set the cluster load type, corresponding to the scenario in the configuration file. If not set, it defaults to htap. #This section is displayed only if the OceanBase Database version to be deployed is not earlier than V4.2.5. Cluster optimization scenario not specified, please specify the scenario you want to optimize. 1. express_oltp 2. complex_oltp 3. olap 4. htap (default) 5. kv Please input the scenario you want to optimize [default: 4]: #Set the log disk size of the cluster to be at least three times the memory size. The corresponding parameter is log_disk_size in the configuration file. Enter the log disk size (Configurable Range[24, 26], Default: 26 , unit: G): #Sets the maximum size that can be automatically expanded for a disk data file, corresponding to the datafile_maxsize configuration parameter. Enter the datafile maxsize (Configurable Range[24, 130], Default: 130 , unit: G): # Enable or disable auto-start, corresponding to the enable_auto_start configuration item. #Only displayed in non-container environments. To enable the auto-start feature, ensure that the deployment user has sudo privileges; otherwise, deployment will fail. Do you want to enable the OceanBase service to start automatically when the system boots up? [y/n] [Default: n]: # Enable or disable business tenant creation. Do you want to create tenant for your business workload? [y/n] [Default: y]:(Optional) Configure tenant information
If you answered
yto the questionDo you need to create a business tenant?, you can configure tenant information as described in this section. If you answeredn, you can skip this section and continue with the deployment process.Note
This section uses OceanBase Database Community Edition as an example. If you are deploying OceanBase Database Enterprise Edition or Standalone Edition, after you set the tenant name, the system will display the
Please select the tenant mode (enter the corresponding number):field. You can configure the compatibility mode for the tenant to be created here. The compatibility mode can be set to MySQL (enter1) or Oracle (enter2).# sys tenant resource information Tenant: sys conifguration: 2C/2G/4G(CPU/Memory/Log disk) system_memory configuration(Unit: G): 5G # Set the tenant name. The tenant name must be 1 to 64 characters in length and can contain uppercase and lowercase letters, digits, and underscores. The first character cannot be a hyphen (-) or a period (.) Enter the tenant name (Default: test; allowed characters: letters, numbers, and underscores): obmysql # Set the password for the tenant administrator. If you do not set a password, the default value is empty. Enter the tenant password: # Confirm the password for the tenant administrator. Confirm the tenant password: # Set the number of CPU cores available to the tenant. Enter the tenant cpu (Configurable Range[1, 6], Default: 6 ): 2 # Set the size of memory available to the tenant, in GB. Enter the tenant memory (Configurable Range[2, 5], Default: 5 , unit: G): 2 # Set the size of the log disk available to the tenant, in GB. Enter the tenant log disk size (Configurable Range[4, 22], Default: 4 , unit: G): 5 # Set the character set for the tenant. Please select the character (enter the corresponding number): 1) utf8mb4 2) utf16 3) gbk 4) gb18030 5) binary Enter the tenant charset (Default: 1): # Set the collation for the tenant. Please select the tenant collation (enter the corresponding number): 1) utf8mb4_general_ci 2) utf8mb4_bin 3) utf8mb4_unicode_ci 4) utf8mb4_unicode_520_ci 5) utf8mb4_croatian_ci 6) utf8mb4_czech_ci 7) utf8mb4_0900_ai_ci Enter the tenant collation (Default: 1): # Set the time zone for the tenant. Please select the tenant time zone (enter the corresponding number): 1) -12:00(International Date Line West) 2) -11:00(Samoa Standard Time) 3) -10:00(Hawaii-Aleutian Standard Time) 4) -09:00(Alaska Standard Time) 5) -08:00(Pacific Standard Time) 6) -07:00(Mountain Standard Time) 7) -06:00(Central Standard Time) 8) -05:00(Eastern Standard Time) 9) -04:00(Atlantic Standard Time) 10) -03:00(Brasilia Standard Time) 11) -02:00(Mid-Atlantic Standard Time) 12) -01:00(Azores Standard Time) 13) +00:00(Greenwich Mean Time) 14) +01:00(Central European Time) 15) +02:00(Eastern European Time) 16) +03:00(Moscow Standard Time) 17) +04:00(Gulf Standard Time) 18) +05:00(Pakistan Standard Time) 19) +06:00(Bangladesh Standard Time) 20) +07:00(Indochina Time) 21) +08:00(China Standard Time) 22) +09:00(Japan Standard Time) 23) +10:00(Australian Eastern Standard Time) 24) +11:00(Solomon Islands Time) 25) +12:00(New Zealand Standard Time) 26) +13:00(Tonga Standard Time) 27) +14:00(Line Islands Time) Enter the tenant time zone (Default: 21): # Set whether to make table names case-sensitive. This parameter is required only when you create a MySQL-compatible tenant. Please select case sensitivity for table names: 0) Table names are stored as specified and compared case-sensitively 1) Table names are stored in lowercase and compared case-insensitively 2) Table names are stored as specified but compared case-insensitively Please enter your choice [0/1/2] [default 1]:(Optional) Configure monitoring information
If you answered
yto the questionDo you need to install the monitoring components, you need to configure the monitoring information. If you answeredn, you can skip this section and continue with the deployment process.# Set the OBAgent monitoring service port, which corresponds to the monagent_http_port parameter in the configuration file. Enter the OBAgent monitoring service port (Default: 8088): # Set the OBAgent management service port, which corresponds to the mgragent_http_port parameter in the configuration file. Enter the OBAgent management service port (Default: 8089): # Set the Prometheus port. Enter the Prometheus port (Default: 9090): # Set the Grafana port. Enter the Grafana port (Default: 3000):Confirm the configurations
The program will output the configurations that you set. You need to confirm whether the configurations are correct. Here is an example:
#Saved configurations: cluster name: myoceanbase mysql port: 2881 rpc port: 2882 obshell port: 2886 cpu count: 8 memory limit: 12G home path: /home/admin/myoceanbase/oceanbase_name data dir: /data/1/myoceanbase log dir: /data/log1/myoceanbase datafile maxsize: 130G log disk size: 26G enable auto start: False tenant name: obmysql tenant cpu: 2 tenant memory: 2G tenant log disk size: 5G mode: mysql time zone: +08:00 charset: utf8mb4 collate: utf8mb4_general_ci optimize: htap variables: ob_tcp_invited_nodes='%', lower_case_table_names=1 monagent http port: 8088 mgragent http port: 8089 prometheus port: 9090 grafana port: 3000 Are you sure these configurations are correct? [y/n] [Default: y]:At the prompt, enter
yornto confirm the configurations. If you entery, the program will start to deploy the OceanBase cluster based on the configurations. If you entern, the deployment process will end immediately.Enable or disable password encryption
Do you want to enable encryption for password security (default_encryption_passkey: 123456)? [y/n] [Default: n]:At the prompt, enter
nto disable password encryption. If you entern, the program will skip this step and continue with the deployment process. You can also enteryto enable password encryption. After you enable password encryption, the passwords will be displayed in encrypted form when you view the cluster information. If you need to view the passwords of the cluster, you must specify the correct encryption key by using the--epkoption. For example,obd cluster display myoceanbase --epk ******.The default encryption key is 123456. After the deployment is completed, you need to run the
obd pwd set-epkcommand to change the encryption key. For more information, see Password commands.Deployment completed
After the cluster is deployed, the program will output the deployment status of the components and the corresponding connection strings. Here is an example:
Wait for observer init ok +------------------------------------------------+ | oceanbase-ce | +--------------+---------+------+-------+--------+ | ip | version | port | zone | status | +--------------+---------+------+-------+--------+ | 10.10.10.1 | 4.3.5.1 | 2881 | zone1 | ACTIVE | +--------------+---------+------+-------+--------+ obclient -h10.10.10.1 -P2881 -uroot@sys -p'******' -Doceanbase -A cluster unique id: 64ccbd30-c104-5576-ad47-1cd0a8010f73-197d381436b-02050304 Connect to Obagent ok +-----------------------------------------------------------------+ | obagent | +--------------+--------------------+--------------------+--------+ | ip | mgragent_http_port | monagent_http_port | status | +--------------+--------------------+--------------------+--------+ | 10.10.10.1 | 8089 | 8088 | active | +--------------+--------------------+--------------------+--------+ Connect to Prometheus ok +----------------------------------------------------------+ | prometheus | +--------------------------+-------+--------------+--------+ | url | user | password | status | +--------------------------+-------+--------------+--------+ | http://10.10.10.1:9090 | admin | '******' | active | +--------------------------+-------+--------------+--------+ Connect to grafana ok +---------------------------------------------------------------------+ | grafana | +--------------------------------------+-------+-------------+--------+ | url | user | password | status | +--------------------------------------+-------+-------------+--------+ | http://10.10.10.1:3000/d/oceanbase | admin | '******' | active | +--------------------------------------+-------+-------------+--------+ obshell program health check ok display obshell dashboard ok +------------------------------------------------------------+ | obshell Dashboard | +---------------------------+------+----------------+--------+ | url | user | password | status | +---------------------------+------+----------------+--------+ | http://10.10.10.1:2886 | root | '********' | active | +---------------------------+------+----------------+--------+ myoceanbase running Get local repositories ok Open ssh connection ok Connect to observer 10.10.10.1:2881 ok Create tenant obmysql ok obclient -h10.10.10.1 -P'2881' -p'' -uroot@obmysql -Doceanbase -A optimize tenant with scenario: htap ok Encrypt password ok
Verify the deployment result
View the list of clusters.
You can run the
obd cluster listcommand to view the list of clusters. If there is a cluster with the deployed namemyoceanbaseand the statusrunning, it indicates that the cluster is running.+----------------------------------------------------------------------+ | Cluster List | +-------------+--------------------------------------+-----------------+ | Name | Configuration Path | Status (Cached) | +-------------+--------------------------------------+-----------------+ | myoceanbase | /home/admin/.obd/cluster/myoceanbase | running | +-------------+--------------------------------------+-----------------+View details of the cluster status.
[admin@test001 ~]$ obd cluster display myoceanbaseOutput is as follows:
Get local repositories and plugins ok Open ssh connection ok Connect to observer 10.10.10.1:2881 ok Wait for observer init ok +------------------------------------------------+ | oceanbase-ce | +--------------+---------+------+-------+--------+ | ip | version | port | zone | status | +--------------+---------+------+-------+--------+ | 10.10.10.1 | 4.3.5.1 | 2881 | zone1 | ACTIVE | +--------------+---------+------+-------+--------+ obclient -h10.10.10.1 -P2881 -uroot@sys -p'******' -Doceanbase -A cluster unique id: 64ccbd30-c104-5576-ad47-1cd0a8010f73-197d381436b-02050304 Connect to Obagent ok +-----------------------------------------------------------------+ | obagent | +--------------+--------------------+--------------------+--------+ | ip | mgragent_http_port | monagent_http_port | status | +--------------+--------------------+--------------------+--------+ | 10.10.10.1 | 8089 | 8088 | active | +--------------+--------------------+--------------------+--------+ Connect to Prometheus ok +------------------------------------------------------+ | prometheus | +--------------------------+-------+----------+--------+ | url | user | password | status | +--------------------------+-------+----------+--------+ | http://10.10.10.1:9090 | admin | '******' | active | +--------------------------+-------+----------+--------+ Connect to grafana ok +------------------------------------------------------------------+ | grafana | +--------------------------------------+-------+----------+--------+ | url | user | password | status | +--------------------------------------+-------+----------+--------+ | http://10.10.10.1:3000/d/oceanbase | admin | '******' | active | +--------------------------------------+-------+----------+--------+ obshell program health check ok display obshell dashboard ok +------------------------------------------------------------+ | obshell Dashboard | +---------------------------+------+----------------+--------+ | url | user | password | status | +---------------------------+------+----------------+--------+ | http://10.10.10.1:2886 | root | '******' | active | +---------------------------+------+----------------+--------+View cluster tenants
obd cluster tenant show myoceanbaseThe following information is returned. The
sysandobmysqltenants exist in the cluster.Get local repositories ok Get deployment connections ok Connect to observer 10.10.10.1:2881 ok Select tenant ok +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | tenant basic info | +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+ | tenant_name | tenant_type | compatibility_mode | primary_zone | max_cpu | min_cpu | memory_size | max_iops | min_iops | log_disk_size | iops_weight | tenant_role | +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+ | sys | SYS | MYSQL | RANDOM | 2.0 | 2.0 | 2G | 9223372036854775807 | 9223372036854775807 | 4G | 2 | PRIMARY | | obmysql | USER | MYSQL | RANDOM | 2.0 | 2.0 | 2G | 9223372036854775807 | 9223372036854775807 | 5G | 2 | PRIMARY | +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+Connect to the cluster
For example, you can use the connection string displayed in the
obd cluster displaycommand result to log in to the sys tenant of the OceanBase cluster, or use the tenant name and password for logging in to a user tenant.obclient -h10.10.10.1 -P2881 -uroot@sys -p'******' -Doceanbase -AThe following output appears, indicating that the sys tenant of the OceanBase cluster is accessed.
Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221490663 Server version: OceanBase_CE 4.3.5.1 (r101020012025061620-3ee44736ead7f159c8b2dd0593ab3d1346997903) (Built Jun 16 2025 21:02:30) Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. obclient(root@sys)[oceanbase]>
Deploy OceanBase Database by using a configuration file
Step 1: Modify the configuration file
If you have installed OBD through direct download, you can view the sample OBD configuration files in the /usr/obd/example directory.
If you installed obd by decompressing an all-in-one package, you can view the sample configuration files provided by obd in the ~/.oceanbase-all-in-one/obd/usr/obd/example directory.
Differences among the configuration file examples are described in the Obtain a Configuration File Example section of Configuration File Description. Choose a configuration file based on your resource conditions.
Note
This topic also provides a sample configuration file for deploying an OceanBase cluster on a single server. You can directly copy and modify the sample configuration file.
This topic uses the mini-single-example.yaml configuration file for a compact mode deployment.
Notes
You must modify the following parameters based on your actual environment.
Modify user information
## Only need to configure when remote login is required user: username: admin # password: your password if need key_file: /home/admin/.ssh/id_rsa # port: your ssh port, default 22 # timeout: ssh connection timeout (second), default 30usernamespecifies the username used to log in to the target machine where the OceanBase cluster is deployed. Ensure that the username has write permissions on thehome_pathspecified below.passwordandkey_fileare both used to verify the username. Generally, only one of them needs to be specified.Note
After you specify the key path, if the key is not required to be associated with a password, you can comment out or delete the
passwordparameter to ensure that the key does not fail to pass the check during the login process. Otherwise, the system will regard the value of thepasswordparameter as the password of the key, which will cause a failure in the key authentication.Modify the IP address, ports, and relevant directories of the server and configure memory-related parameters and the password for the root@sys user.
oceanbase-ce: # version: 4.3.5.0 servers: - name: server1 ip: 10.10.10.1 global: # Please set devname as the network adaptor's name whose ip is in the setting of severs. # if set severs as "127.0.0.1", please set devname as "lo" # if current ip is 192.168.1.10, and the ip's network adaptor's name is "eth0", please use "eth0" devname: eth0 cluster_id: 1 # please set memory limit to a suitable value which is matching resource. memory_limit: 6G # The maximum running memory for an observer system_memory: 1G # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G. datafile_size: 2G # Size of the data file. datafile_next: 2G # the auto extend step. Please enter an capacity, such as 2G datafile_maxsize: 20G # the auto extend max size. Please enter an capacity, such as 20G log_disk_size: 14G # The size of disk space used by the clog files. cpu_count: 16 scenario: htap enable_auto_start: true mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started. rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started. obshell_port: 2886 # Operation and maintenance port for Oceanbase Database. The default value is 2886. This parameter is valid only when the version of oceanbase-ce is 4.2.2.0 or later. production_mode: false # The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field. home_path: /home/admin/observer # The directory for data storage. The default value is $home_path/store. data_dir: /data # The directory for clog, ilog, and slog. The default value is the same as the data_dir value. redo_dir: /redo root_password: ****** # root user password, can be empty zone: zone1For details about the parameters in the configuration file, see the Description of parameters section in Configuration File Description. Note the following items:
If the password is not configured in the configuration file, OBD generates a random password. After the deployment succeeds, you can view the password corresponding to the configuration item by running the
obd cluster edit-configcommand.If the OceanBase Database version to be deployed is not less than V4.2.5 and the
scenarioparameter is not specified in the configuration file, obd will provide interactive options for users to select the load type.The parameter
enable_auto_startmust be set totrueto enable automatic startup of the observer process at boot. This feature requires that the deployed user has sudo privileges, and it only works in non-containerized environments.To deploy an OceanBase cluster in a single-machine multi-node deployment mode, you can configure multiple server nodes in
oceanbase-ce->serverswith the same IP address. Ensure that different ports and directories are specified for each server. For specific configuration file details, see Example configuration file.
Step 2: Deploy OceanBase Database
Notes
For more information about the commands mentioned in this section, see Commands for a cluster.
Deploy an OceanBase cluster.
[admin@test001 ~]$ obd cluster deploy obtest -c mini-single-example.yamlFor example, a cluster named
obtestis deployed based on themini-single-example.yamlfile. You can customize the name of the deployed cluster and specify the corresponding configuration file.This command checks whether the directories pointed to by
home_pathanddata_dirare empty. If not, an error will be returned. If you confirm that you can delete all contents in this directory, you can add the-foption to force the clearing of the directory.Start the OceanBase cluster
[admin@test001 ~]$ obd cluster start obtestOnce the cluster is started, it outputs information about the deployment of each component and the corresponding connection string. The following example shows how it looks:
Wait for observer init ok +-------------------------------------------------+ | oceanbase-ce | +---------------+---------+------+-------+--------+ | ip | version | port | zone | status | +---------------+---------+------+-------+--------+ | 10.10.10.1 | 4.3.5.2 | 2881 | zone1 | ACTIVE | +---------------+---------+------+-------+--------+ obclient -h10.10.10.1 -P2881 -uroot@sys -p'******' -Doceanbase -A cluster unique id: 14c23fe5-e9dc-576f-9a93-d13ca1b2e915-197d4e2de9b-02050304 obshell program health check ok display obshell dashboard ok +-----------------------------------------------------------+ | obshell Dashboard | +---------------------------+------+---------------+--------+ | url | user | password | status | +---------------------------+------+---------------+--------+ | http://10.10.10.1:2886 | root | '******' | active | +---------------------------+------+---------------+--------+
Step 3: Verify the deployment result
View the cluster list
You can execute the
obd cluster listcommand to view the cluster list. If a cluster namedobtestwith a status ofrunningexists, it indicates that the cluster is running.+----------------------------------------------------------------------+ | Cluster List | +-------------+--------------------------------------+-----------------+ | Name | Configuration Path | Status (Cached) | +-------------+--------------------------------------+-----------------+ | obtest | /home/admin/.obd/cluster/test | running | +-------------+--------------------------------------+-----------------+View the specific status of the cluster
[admin@test001 ~]$ obd cluster display obtestThe output is as follows:
Get local repositories and plugins ok Open ssh connection ok Connect to observer 10.10.10.1:2881 ok Wait for observer init ok +-------------------------------------------------+ | oceanbase-ce | +---------------+---------+------+-------+--------+ | ip | version | port | zone | status | +---------------+---------+------+-------+--------+ | 10.10.10.1 | 4.3.5.2 | 2881 | zone1 | ACTIVE | +---------------+---------+------+-------+--------+ obclient -h10.10.10.1 -P2881 -uroot@sys -p'******' -Doceanbase -A cluster unique id: 14c23fe5-e9dc-576f-9a93-d13ca1b2e915-197d4e2de9b-02050304 obshell program health check ok display obshell dashboard ok +-----------------------------------------------------------+ | obshell Dashboard | +---------------------------+------+---------------+--------+ | url | user | password | status | +---------------------------+------+---------------+--------+ | http://10.10.10.1:2886 | root | '******' | active | +---------------------------+------+---------------+--------+Connect to the cluster
You can copy the connection string from the
obd cluster displaycommand to connect to the sys tenant of the OceanBase cluster. Alternatively, you can connect to a user tenant using the configured tenant name and password.obclient -h10.10.10.1 -P2881 -uroot@sys -p'******' -Doceanbase -AThe output is as follows, indicating that you have successfully logged in to the sys tenant of the OceanBase cluster as the root user.
Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221494505 Server version: OceanBase_CE 4.3.5.2 (r102010012025052715-2291c2a4ef1863f12286914f6bb56108fb7bc25c) (Built May 27 2025 15:15:24) Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. obclient(root@sys)[oceanbase]>
Related operations
You can run the following commands to manage the cluster deployed by using obd. For more information, see Cluster commands.
View the list of clusters.
obd cluster listView the status of the cluster named
obtest.obd cluster display obtestCreate a user tenant. For example, create a
testtenant for theobtestcluster.obd cluster tenant create obtest -n test --max-cpu=2 --memory-size=2G --log-disk-size=3G --max-iops=10000 --iops-weight=2 --unit-num=1 --charset=utf8 -o htap -s 'ob_tcp_invited_nodes="%"'Note
After you deploy an OceanBase cluster, we recommend that you create business tenants for business operations. The sys tenant is only used for cluster management and is not suitable for business scenarios. You can run the
obd cluster tenant createcommand to create a tenant, or connect to OceanBase Database and run an SQL statement to create a tenant.Modify the cluster parameters.
OceanBase Database has hundreds of parameters. Some parameters are coupled. Before you are familiar with OceanBase Database, we recommend that you do not modify the parameters in the sample configuration file.
Run the following command to open the configuration file and modify the cluster parameters.
obd cluster edit-config obtestAfter you modify the parameters and save the file, obd will prompt you to run a command to make the modification take effect. You can copy the command from the obd output. The output after you save the file is as follows:
Search param plugin and load ok Search param plugin and load ok Parameter check ok Save deploy "obtest" configuration Use `obd cluster reload obtest` to make changes take effect.Copy and run the
obd cluster reload obtestcommand in the output to make the modification take effect.Stop the running cluster named
obtest.obd cluster stop obtestDelete the deployed cluster named
obtest.obd cluster destroy obtest
Sample configuration files
user:
username: admin
password: ********
# key_file: /home/admin/.ssh/id_rsa
oceanbase-ce:
# version: 4.3.5.0
servers:
- name: server1
ip: 10.10.10.1
global:
devname: eth0
cluster_id: 1
memory_limit: 6G
system_memory: 1G
datafile_size: 2G
datafile_next: 2G
datafile_maxsize: 20G
log_disk_size: 14G
cpu_count: 16
scenario: htap
enable_auto_start: true
mysql_port: 2881
rpc_port: 2882
obshell_port: 2886
production_mode: false
home_path: /home/admin/observer
data_dir: /data/date
redo_dir: /data/redo
root_password: ******
zone: zone1
user:
username: admin
password: ********
# key_file: /home/admin/.ssh/id_rsa
oceanbase-ce:
servers:
- name: server1
ip: 10.10.10.1
- name: server2
ip: 10.10.10.1
- name: server3
ip: 10.10.10.1
global:
devname: eth0
cluster_id: 1
memory_limit: 6G # The maximum running memory for an observer
system_memory: 1G # The reserved system memory. system_memory is reserved for general tenants.
datafile_size: 2G # Size of the data file.
datafile_next: 2G
datafile_maxsize: 20G
log_disk_size: 14G
production_mode: false
scenario: htap
enable_auto_start: true
appname: obdemo
root_password: ********
server1:
zone: zone1
mysql_port: 3881
rpc_port: 3882
obshell_port: 3886
home_path: /home/admin/observer1
data_dir: /data/data1
redo_dir: /data/redo1
server2:
zone: zone2
mysql_port: 4881
rpc_port: 4882
obshell_port: 4886
home_path: /home/admin/observer2
data_dir: /data/data2
redo_dir: /data/redo2
server3:
zone: zone3
mysql_port: 5881
rpc_port: 5882
obshell_port: 5886
home_path: /home/admin/observer3
data_dir: /data/data3
redo_dir: /data/redo3
