This topic describes how to use OceanBase Deployer (OBD) to deploy OceanBase Database Proxy (ODP). Perform the following steps:
Prepare the installation environment
Choose a suitable version
Use OBD to install ODP
Perform check after the installation
You can also deploy ODP in the following ways:
Use OceanBase Cloud Platform (OCP) to install and deploy ODP. For more information, see Create an OBProxy cluster.
Use an RPM package to install and deploy ODP.
Prepare the installation environment
Platform: X86_64 or ARM
Operating system: Red Hat Linux (x86_64) of version 5, 6, 7, or later
CPU: ODP occupies about 70% of the resources of a CPU core during operation.
Memory: ODP occupies about 100 MB of memory during operation.
Disk size: The disk space is determined by your data size. We recommend that you use a disk that has 10 GB or more of space.
OceanBase cluster: For more information, see OceanBase deployment overview.
Choose a suitable version
If you install ODP for learning purposes, install the latest version. For a production environment, we recommend that you check the new features and fixed issues of each version.
ODP is now available as an open-source project. You can find the OBProxy project under the open-source OceanBase Database project. Click Releases to view the details of each version. Each version of ODP has been tested in terms of features , stress handling, and performance, and can be used with guaranteed performance.
Procedure
Step 1: Download and install OBD
OBD is the most efficient deployment tool to make ODP ready to work. We recommend that you use OBD to deploy ODP.
Download and install OBD by performing the following steps. If the server has access to the Internet and allows you to add a third-party YUM repository as the software source, you can run the following command to install OBD from the official software source of OceanBase:
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
sudo yum install -y ob-deploy
source /etc/profile.d/obd.sh
If the server does not have access to the Internet, use other server to download the OBD installation package from the releases page on GitHub, and then transfer the installation package to the server you are using for installation.
Step 2: Modify the configuration file
After OBD is installed, you can view the configuration files provided by OBD in the /usr/obd/example/ directory and select the appropriate configuration file as required.
OBD installs the latest version of ODP by default. If you want to install another version, specify the desired version in the configuration file. You can set the ODP configuration in the configuration file as follows. For more information about the parameters, see Parameter description.
obproxy-ce:
version: 3.2.3
# Set dependent components for the component.
# When the associated configurations are not done, OBD will automatically get these configurations from the dependent components.
depends:
- oceanbase-ce
servers:
- 10.10.10.1
global:
listen_port: 2883 # External port. The default value is 2883.
prometheus_listen_port: 2884 # The Prometheus port. The default value is 2884.
home_path: /root/obproxy
# oceanbase root server list
# format: ip:mysql_port;ip:mysql_port. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
rs_list: 10.10.10.2:2881;10.10.10.3:2881;10.10.10.4:2881
enable_cluster_checkout: false
# observer cluster name, consistent with oceanbase-ce's appname. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
# cluster_name: obcluster
skip_proxy_sys_private_check: true
enable_strict_kernel_release: false
# obproxy_sys_password: # obproxy sys user password, can be empty. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
observer_sys_password: # proxyro user password, consistent with oceanbase-ce's proxyro_password, can be empty. When a depends exists, OBD gets this value
Notice
When you configure the
rs_listparameter, you must specify the IP address and MySQL port number of the OceanBase cluster accessible to the ODP.The value of the
observer_sys_passwordparameter must be the same as that of theproxyro_passwordparameter specified when you deployed the OceanBase cluster.
Step 3: Deploy ODP
If the server has access to the Internet, perform steps 4 and 5 directly. If the server does not have access to the Internet, download the ODP installation package from the Releases page on GitHub, and then copy the installation package to the local image repository as follows:
Run the following command to disable the remote image repository:
obd mirror disable <mirror repo name>The
mirror repo nameparameter specifies the name of the image repository to be disabled. If you set this parameter toremote, all remote image repositories are disabled.Run the following command to copy the ODP installation package to the local image repository:
obd mirror clone <path> [-f]The
pathparameter specifies the path of the RPM package. The-foption indicates--force, which is optional and is disabled by default. When this option is enabled, if an image already exists, the image is forcibly overwritten.Run the following command to get the list of RPM packages in the local image repository:
obd mirror list localRun the following command to deploy ODP:
obd cluster deploy <deploy_name> -c <deploy_config_path>In the preceding command, the
deploy_nameparameter specifies the cluster name, which can be understood as the alias of the configuration file.deploy_config_pathspecifies the path of the configuration file.Note
During online installation, after you run the
obd cluster deploycommand, OBD checks the target server for the ODP installation package. If the package does not exist, OBD automatically obtains the package from the YUM repository.Run the following command to start ODP:
obd cluster start <deploy_name>
Step 4: Perform check after the installation
Run the following command to view the deployment result:
obd cluster display <deploy_name> # Example [admin@test ~]$ obd cluster display obtest Get local repositories and plugins ok Open ssh connection ok Cluster status check ok Connect to observer ok Wait for observer init ok +----------------------------------------------+ | observer | +------------+---------+------+-------+--------+ | ip | version | port | zone | status | +------------+---------+------+-------+--------+ | 10.10.10.2 | 4.0.0.0 | 2881 | zone1 | ACTIVE | | 10.10.10.3 | 4.0.0.0 | 2881 | zone2 | ACTIVE | | 10.10.10.4 | 4.0.0.0 | 2881 | zone3 | ACTIVE | +-----------+---------+------+-------+--------+ obclient -h10.10.10.2 -P2881 -uroot -p****** -Doceanbase Connect to obproxy ok +----------------------------------------------+ | obproxy | +------------+------+-----------------+--------+ | ip | port | prometheus_port | status | +------------+------+-----------------+--------+ | 10.10.10.1 | 2883 | 2884 | active | +------------+------+-----------------+--------+ obclient -h10.10.10.1 -P2883 -uroot -p****** -DoceanbaseThe
obproxyinformation is returned.2883in the port column indicates that Port 2883 provides the SQL service. This port is required in the JDBC URL.After you confirm the status by using the
obd cluster displaycommand, you can use a terminal to log on to the server that hosts the obproxy process and run theps -ef | grep obproxycommand to view the process information.[admin@test ~]# ps -ef | grep obproxy | grep -v grep admin 6868 1 0 Nov12 ? 00:02:09 bash /home/admin/obproxy/obproxyd.sh /home/admin/obproxy 10.10.10.1 2883 daemon admin 6901 1 0 Nov12 ? 00:44:11 /home/admin/obproxy/bin/obproxy --listen_port 2883You can find the
obproxyd.shandobproxyprocesses in the return information of the preceding example.obproxyis the name of the ODP process, andobproxyd.shis the daemon script of ODP. Theobproxyd.shprocess is responsible for starting the obproxy process and performs health check on the obproxy process. If the obproxy process does not exist, obproxyd.sh will actively pull up the process.
Common issues in deployment
Startup failed
In a Linux system, ODP uses the enable_strict_kernel_release parameter to control the verification of the operating system version. If the operating system fails the check, the startup fails. The key logs are as follows:
[2021-10-13 10:38:17.235062] WARN [PROXY] get_kernel_release_by_uname (ob_config_server_processor.cpp:1039) [2060][Y0-0] [lt=14] [dc=0] unknown uname release(uinfo.release="4.18.0-80.el8.x86_64", ret=-4016)
You can run the uname command to view kernel information. This option supports only the EL series and AliOS series. The check strategies are conservative, and false errors may be reported. If you encounter the preceding issue in other Linux systems, you can disable the parameter to solve the problem.
Failed to connect to OceanBase Database
ODP establishes a connection with OceanBase Database by using the proxyro user. If the proxyro user does not exist or the password of the proxyro user is inconsistent with the value of the observer_sys_password parameter of ODP, ODP fails to connect to OceanBase Database, and the following error is reported:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 11
In this case, choose a solution according to your situation:
The proxyro user does not exist.
Use the
root@sysuser to access OceanBase Database directly, and create the proxyro user in the sys tenant.create user proxyro identified by '*******'; grant select on *.* to proxyro;The password of the proxyro user is inconsistent with the value of the
observer_sys_passwordparameter of ODP.You can use the
root@sysuser to access OceanBase Database directly and change the password of the proxyro user to make it consistent with the value of theobserver_sys_passwordparameter that you set during ODP startup.ALTER USER proxyro IDENTIFIED BY 'password';You can also log on to ODP with the
root@proxysysaccount and change the password ofproxyro@sys. After the change, restart the ODP.alter proxyconfig set observer_sys_password = 'password';
Notice
Enter the original value of the password rather than the SHA1-hashed value for
passwordin the preceding statement.