View the version
After ODP is installed, check the version of ODP in the following ways:
View the directory of the ODP. The directory of the ODP of the new version contains the version number. For example, the
obproxy-4.0.0directory indicates ODP version 4.0.0.Run the
./bin/obproxy -Vcommand in the home directory of the ODP to view the version of the ODP. Take version 3.2.3 as an example:[admin@test obproxy]# ./bin/obproxy -V ./bin/obproxy -V obproxy (OceanBase 3.2.3 2) REVISION: 6-local-99faebfc7130b70ad0f56330a28cab6a32ec9a33 BUILD_TIME: Mar 30 2022 01:53:08Log on to the ODP with the
root@proxysysaccount, and run theshow proxyinfo binarycommand to view the version of the ODP. Take version 4.0.0 as an example:MySQL [(none)]> show proxyinfo binary\G *************************** 1. row *************************** name: binary info info: ObProxy-OceanBase 4.0.0-20221103165243.el7 version:RELEASE_7U MD5 REVISION:20221103165243-7c7e5821009b2d3924d1bc7a8165edf7384f6ed3 BUILD_TIME:Nov 3 2022 16:57:16
Connect to OceanBase Database
Run the following command to connect to an OceanBase cluster by using the OBClient or MySQL client through ODP:
obclient -h<obproxy_ip> -u<user> -P<obproxy_port> -p<obproxy_pwd>
Or
mysql -h<obproxy_ip> -u<user> -P<obproxy_port> -p<obproxy_pwd>
# Example
obclient -h10.10.10.1 -uroot@sys#obcluster -P2883 -p******
Parameters:
-h: specifies the IP address for connecting to OceanBase Database, which is usually the IP address of the ODP.-u: specifies the tenant account. Two account formats are supported:Username@Tenant name#Cluster nameandCluster name:Tenant name:Username.-P: specifies the port for connecting to OceanBase Database, which is also the listened-to port of the ODP. Default value: 2883, which can be customized.-p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
Restart ODP
After the ODP process exits, obproxyd.sh will pull up the ODP process again within 1s. Therefore, you may not perceive an ODP exit. In a production environment, this mechanism can quickly restore services and prevent damages.
If you want to manually restart the ODP service, use the kill command to stop the obproxy process. After the first startup, the configuration file is generated in the etc and .conf directories, and the configuration information is persisted. Therefore, you can simply execute the ./bin/obproxy command to restart the service.
If you want to use the default configuration, run rm -rf etc .conf to delete the persisted configuration information, and then run the initial startup command.
You can check the startup time to determine whether the ODP has been restarted. To check the startup time, you can use view the succ to init logger log, which is printed only once during startup. You can also run the following command to check the startup time:
-bash-4.2$ ls -l /proc/`pidof obproxy` -d
dr-xr-xr-x 8 admin admin 0 Nov 14 14:18 /proc/118273
Directories
The directory structure of ODP is as follows:
-bash-4.2$ ls -alrt
total 48
-rw-r--r-- 1 admin admin 14245 Nov 3 16:57 start_obproxy.sh
drwxr-xr-x 2 admin admin 4096 Nov 14 14:15 bin
drwxr-xr-x 2 admin admin 4096 Nov 14 14:15 tools
lrwxrwxrwx 1 admin admin 28 Nov 14 14:15 log -> /home/admin/logs/obproxy/log
lrwxrwxrwx 1 admin admin 33 Nov 14 14:15 minidump -> /home/admin/logs/obproxy/minidump
drwxr-xr-x 1 root root 4096 Nov 14 14:16 ..
drwxrwxr-x 2 admin admin 4096 Nov 14 14:18 sharding-config
drwxrwxr-x 2 admin admin 4096 Nov 14 14:18 control-config
drwxr-xr-x 8 admin admin 4096 Nov 14 14:18 .
drwxrwxr-x 2 admin admin 4096 Nov 14 14:18 etc
drwxrwxr-x 2 admin admin 4096 Nov 14 14:18 .conf
Important directories and files include:
start_obproxy.sh: The guardian script. Its content is simple. You can read the script code to understand the implementation principle.bindirectory: stores ODP binary files.logdirectory: stores log files. This directory occupies the largest disk space. Log files are divided into various types to help you troubleshoot and locate issues.sharding-configdirectory: stores configuration files related to sharding.etcand.confdirectories: store configuration information. The.confdirectory is a backup of theetcdirectory. If theetcdirectory is deleted, the contents of the.confdirectory is used.