Prerequisites
You have installed OceanBase Deployer (obd) (latest version recommended) on your server. For more information, see Install obd.
The user and server resources for OCP deployment meet the requirements. For more information, see Installation planning.
Your server can connect to the Internet, or the local image repository of obd contains the installation packages required for deployment.
You can run the
obd mirror list localcommand to query the installation packages in the local image repository. If obd is installed by using the OceanBase All in One package, the local image repository contains all installation packages required for deployment by default.You have installed the
clockdiffcommand.Your account has the privilege to run the
sudocommand without a password.
Note
This topic assumes that the server mentioned in this topic can connect to the Internet or the required software programs such as OceanBase Database, OceanBase Database Proxy (ODP), and OCP are installed on the server.
Configuration files
obd provides sample configuration files for deploying OCP. You can modify the files based on your server resources.
If you have installed obd by downloading the RPM package for obd, you can view the sample configuration files in the
/usr/obd/exampledirectory.If you have installed obd by using the all-in-one installation package, you can view the sample configuration files in the
~/.oceanbase-all-in-one/obd/usr/obd/exampledirectory.You can also view the sample configuration files on GitHub.
obd provides the following sample configuration files for deploying OCP:
Sample configuration file for separate deployment of OCP:
ocp-only-example.yamlSample configuration file for distributed deployment of ODP and OCP:
distributed-with-obproxy-and-ocp-example.yaml
Procedure
This section describes how to deploy OCP separately and deploy OCP together with OceanBase Database.
When you deploy OCP separately, you must first create the MetaDB and corresponding tenants (
ocp_metaandocp_monitor) for OCP. For more information, see Deploy OceanBase Database on a single server or Deploy an OceanBase cluster on the GUI. You can create a tenant manually or by using an obd command as needed. For more information about how to manually create a tenant, see Create a tenant. For more information about how to create a tenant by using an obd command, see the obd cluster tenant create section in Cluster commands.When you deploy OCP together with OceanBase Database, you can specify information about OceanBase Database and OCP in the configuration file. When OCP is started, OceanBase Database is started as its MetaDB as configured.
Create a configuration file.
Run the following command to create a configuration file. Here,
ocp-only-example.yamlis used as an example, and you can customize the file name.vim ocp-only-example.yamlModify user information.
Copy and paste the following content to the file and modify the parameters as needed.
## 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 of the account used to log in to the target server. Make sure that this account has the write permission on the home directory.passwordandkey_fileare used for user authentication. Generally, you need to specify only one of them.Notice
After you specify the path of the key, comment out or delete the
passwordparameter if your key does not require a password. Otherwise, the value of thepasswordparameter will be taken as the password of the key and used for login, leading to a login verification failure.Modify OCP configurations.
Copy and paste the following content to the file and modify the parameters as needed. For more information about the parameters, see the Parameters section in Configuration files.
ocp-server-ce: version: 4.2.2 # package_hash: 84a65bf0ec004e73b772938696b2b896a0ef2b2f # release: 20240315150922.el7 servers: - 10.10.10.1 global: home_path: /home/admin/ocp soft_dir: /home/admin/software log_dir: /home/admin/logs ocp_site_url: http://10.10.10.1:8080 port: 8080 admin_password: ******** memory_size: 4G manage_info: machine: 10 jdbc_url: jdbc:oceanbase://10.10.10.2:2881/test jdbc_username: root@sys jdbc_password: ******** ocp_meta_tenant: tenant_name: ocp_meta max_cpu: 2.0 memory_size: 4G ocp_meta_username: root ocp_meta_password: ******** ocp_meta_db: meta_database ocp_monitor_tenant: tenant_name: ocp_monitor max_cpu: 2.0 memory_size: 4G ocp_monitor_username: root ocp_monitor_password: ******** ocp_monitor_db: monitor_databaseDeploy OCP.
obd cluster deploy ocp -c ocp-only-example.yamlocpspecifies the cluster name. You can use a custom name as needed. After OCP is deployed, the command returns a start command, as shown below:ocp deployed Please execute ` obd cluster start ocp ` to start Trace ID: 4e444844-0211-11ef-8e69-00163e0808cc If you want to view detailed obd logs, please run: obd display-trace 4e444844-0211-11ef-8e69-00163e0808ccStart OCP.
obd cluster start ocpAfter OCP is started, the command returns the login information of OCP, as shown below:
+----------------------------------------------------------+ | ocp-server-ce | +---------------------------+----------+----------+--------+ | url | username | password | status | +---------------------------+----------+----------+--------+ | http://10.10.10.1:8080 | admin | ******** | active | +---------------------------+----------+----------+--------+ ocp running Trace ID: ed5a1f4c-0218-11ef-bda1-00163e0808cc If you want to view detailed obd logs, please run: obd display-trace ed5a1f4c-0218-11ef-bda1-00163e0808cc
Step 1: Create a configuration file
Run the following command to create a configuration file. Here, distributed-ocp.yaml is used as an example, and you can customize the file name.
vim distributed-ocp.yaml
Step 2: Modify the configuration file
Modify user information.
Copy and paste the following content to the file and modify the parameters as needed.
## 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 of the account used to log in to the target server. Make sure that this account has the write permission on the home directory.passwordandkey_fileare used for user authentication. Generally, you need to specify only one of them.Notice
After you specify the path of the key, comment out or delete the
passwordparameter if your key does not require a password. Otherwise, the value of thepasswordparameter will be taken as the password of the key and used for login, leading to a login verification failure.Modify OceanBase Database configurations.
Copy and paste the following content to the file and modify the parameters as needed.
oceanbase-ce: version: 4.3.0.1 # release: 100000242024032211.el7 # package_hash: c4a03c83614f50c99ddb1c37dda858fa5d9b14b7 servers: - name: server1 ip: 10.10.10.1 - name: server2 ip: 10.10.10.2 - name: server3 ip: 10.10.10.3 global: appname: obcluster cluster_id: 1711955629 mysql_port: 2881 rpc_port: 2882 home_path: /home/admin/oceanbase data_dir: /home/admin/oceanbase/data redo_dir: /home/admin/oceanbase/redo obshell_port: 2886 scenario: htap memory_limit: 64G system_memory: 30G log_disk_size: 192G datafile_size: 192GB ocp_meta_tenant: tenant_name: ocp_meta max_cpu: 2.0 memory_size: 4G ocp_meta_username: root ocp_meta_password: ******** ocp_meta_db: meta_database ocp_monitor_tenant: tenant_name: ocp_monitor max_cpu: 2.0 memory_size: 8G ocp_monitor_username: root ocp_monitor_password: ******** ocp_monitor_db: monitor_database proxyro_password: ******** root_password: ******** ocp_meta_tenant_log_disk_size: 6656M enable_syslog_recycle: true enable_syslog_wf: false max_syslog_file_count: 4 cpu_count: 20 server1: zone: zone1 server2: zone: zone2 server3: zone: zone3For more information about the parameters of OceanBase Database, see the Parameters section in Configuration files. The following table describes the parameters related to OCP.
Parameter Required Default value Effective mode of modification Description ocp_meta_tenant Yes tenant_name: meta_tenant
max_cpu: 1
memory_size: 2147483648Redeployment The information about the OCP meta tenant. tenant_name: the name of the tenant.max_cpu: the maximum number of CPU cores for OCP MetaDB.memory_size: the size of memory for OCP MetaDB.
ocp_meta_username No meta Process restart The username for connecting to the OCP meta tenant. ocp_meta_password Yes oceanbase Process restart The password corresponding to the username specified by ocp_meta_username.ocp_meta_db No meta_database Redeployment The database name of OCP MetaDB. ocp_monitor_tenant Yes tenant_name: monitor_tenant
max_cpu: 1
memory_size: 2147483648Redeployment The information about the OCP monitor tenant. tenant_name: the name of the tenant.max_cpu: the maximum number of CPU cores for OCP MonitorDB.memory_size: the size of memory for OCP MonitorDB.
ocp_monitor_username No monitor_user Process restart The username for connecting to the OCP monitor tenant. ocp_monitor_password Yes oceanbase Process restart The password corresponding to the username specified by ocp_monitor_username.ocp_monitor_db No monitor_database Redeployment The database name of OCP MonitorDB. ocp_meta_tenant_log_disk_size No 2048M Redeployment The size of the log disk for tenants in OCP MetaDB. Modify ODP configurations.
Copy and paste the following content to the file and modify the parameters as needed. For more information about the parameters, see the Parameters section in Configuration files.
obproxy-ce: version: 4.2.3.0 # package_hash: 7ca6c000887b90db111093180e6984bf4cf8f7380a948870f3eb2ac30be38f37 # release: 3.el7 depends: - oceanbase-ce servers: - 10.10.10.1 global: home_path: /home/admin/obproxy prometheus_listen_port: 2884 listen_port: 2883 obproxy_sys_password: ******** skip_proxy_sys_private_check: true enable_strict_kernel_release: false enable_cluster_checkout: false proxy_id: 5150 client_session_id_version: 2Modify OCP configurations.
Copy and paste the following content to the file and modify the parameters as needed. For more information about the parameters, see the Parameters section in Configuration files.
ocp-server-ce: version: 4.2.2 # package_hash: 84a65bf0ec004e73b772938696b2b896a0ef2b2f # release: 20240315150922.el7 depends: - oceanbase-ce - obproxy-ce servers: - 10.10.10.1 global: home_path: /home/admin/ocp soft_dir: /home/admin/software log_dir: /home/admin/logs ocp_site_url: http://10.10.10.1:8080 port: 8080 admin_password: ******** memory_size: 8G manage_info: machine: 10
Step 3: Deploy OCP
Deploy OCP.
obd cluster deploy ocp -c ocp-only-example.yamlocpspecifies the cluster name. You can use a custom name as needed. After OCP is deployed, the command returns a start command, as shown below:ocp deployed Please execute `obd cluster start ocp` to start Trace ID: 990e7dba-0223-11ef-ab25-00163e0808cc If you want to view detailed obd logs, please run: obd display-trace 990e7dba-0223-11ef-ab25-00163e0808ccStart OCP.
obd cluster start ocpAfter OCP is started, the command returns cluster information, as shown below:
+-------------------------------------------------+ | oceanbase-ce | +---------------+---------+------+-------+--------+ | ip | version | port | zone | status | +---------------+---------+------+-------+--------+ | 10.10.10.1 | 4.3.0.1 | 2881 | zone1 | ACTIVE | | 10.10.10.2 | 4.3.0.1 | 2881 | zone2 | ACTIVE | | 10.10.10.3 | 4.3.0.1 | 2881 | zone3 | ACTIVE | +---------------+---------+------+-------+--------+ obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A +-------------------------------------------------+ | obproxy-ce | +---------------+------+-----------------+--------+ | ip | port | prometheus_port | status | +---------------+------+-----------------+--------+ | 10.10.10.1 | 2883 | 2884 | active | +---------------+------+-----------------+--------+ obclient -h10.10.10.1 -P2883 -uroot@proxysys -p'********' -Doceanbase -A +----------------------------------------------------------+ | ocp-server-ce | +---------------------------+----------+----------+--------+ | url | username | password | status | +---------------------------+----------+----------+--------+ | http://10.10.10.1:8080 | admin | ******** | active | +---------------------------+----------+----------+--------+ ocp running
References
After you deploy a cluster by using obd, you can restart/reload, stop, or destroy the cluster by using obd. For more information, see Cluster commands.
For more information about how to use OCP after it is deployed, see the OCP documentation.