This topic describes how to deploy oblogproxy by using the command line in the following two scenarios: full-component deployment (with OceanBase Database) and adding oblogproxy.
Note
The machine used in this topic can connect to the Internet or has the required software (OceanBase Database, ODP, oblogproxy, obconfigserver, etc.) installed. If you installed obd by using OceanBase All in One, the local image library contains the installation packages of all components required for deployment.
Full-component deployment: This refers to the deployment of all components (oceanbase-ce, obproxy-ce, ob-configserver, and oblogproxy) by using obd in an environment where no OceanBase components are deployed. The obd version must be V2.5.0 or later.
Adding oblogproxy: This refers to the deployment of oblogproxy in an environment where an OceanBase cluster is already deployed. The obd version must be V2.9.0 or later. Otherwise, refer to Install oblogproxy for deployment.
Components
OBProxy
OceanBase Database Proxy, also known as ODP, is a proxy server specifically designed for OceanBase Database.
obconfigserver
OceanBase Configserver, which provides metadata registration, storage, and query services for OceanBase.
oblogproxy
OceanBase's incremental log proxy service, which connects to OceanBase and reads incremental logs, providing change data capture (CDC) capabilities to downstream services.
Configuration files
obd provides sample configuration files for deploying oblogproxy. You can modify these files based on your machine's resources.
If you installed obd by directly downloading it, you can view the sample oblogproxy configuration files provided by obd in the
/usr/obd/example/oblogproxydirectory.If you installed obd by decompressing the all-in-one installation package, you can view the sample oblogproxy configuration files provided by obd in the
~/.oceanbase-all-in-one/obd/usr/obd/example/oblogproxydirectory.You can also view the sample oblogproxy configuration files provided by obd in the GitHub repository of obd.
The following are the sample configuration files provided by obd for deploying oblogproxy.
Full deployment (oceanbase-ce, obproxy-ce, ob-configserver, and oblogproxy): distributed-with-obproxy-and-oblogproxy-example.yaml
Standalone deployment of oblogproxy: oblogproxy-only-example.yaml
Adding the oblogproxy component: oblogproxy-component-add.yaml
Procedure
Scenarios
No OceanBase components are deployed in the current environment. All components (oceanbase-ce, obproxy-ce, ob-configserver, and oblogproxy) are deployed by obd in a single cluster.
Note
If you want to use the Binlog Service of oblogproxy, you need to deploy OBProxy and obconfigserver.
Prerequisites
Before you deploy oblogproxy, make sure that you have installed V2.5.0 or later of obd. We recommend that you install the latest version. For more information, see Install obd.
If you deploy an OceanBase cluster at the same time, make sure that the OBServer nodes support the AVX instruction set (this requirement applies only to servers with the x86 architecture). You can run the
lscpu | grep Flags | grep avxcommand to check whether the AVX instruction set is supported.Note
When you use servers with the x86 architecture, if the version of the OceanBase Database to be deployed is within the following range, there is no requirement on whether the AVX instruction set is supported:
- For V4.2.x, the version must be V4.2.5.6 or later.
- For V4.3.x, the version must be V4.3.5.4 or later.
- For V4.4.x, the version must be V4.4.1.0 or later.
In an offline deployment scenario, if you deploy an OceanBase cluster at the same time and use servers with the ARM architecture, make sure that the OBServer nodes support the LSE instruction set. You can run the
lscpu | grep Flags | grep atomicscommand to check whether the LSE instruction set is supported. If the LSE instruction set is not supported, download the OceanBase Database installation package with thenonlseoption and run theobd mirror clonecommand to upload the installation package to the local image library of obd.Note
The OceanBase Database installation package with the
nonlseoption is not included in the OceanBase All in One package.
Procedure
This topic uses the distributed-with-obproxy-and-oblogproxy-example.yaml configuration file as an example to describe how to deploy oblogproxy.
Configure user information
The following code shows the user information configuration in the configuration file:
## 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 for logging in to the target server. Ensure that the username has write permissions for thehome_path.passwordandkey_fileare used for user authentication. Typically, you need to specify only one of them.Notice
After you specify the key path, if your key does not require a password, comment out or delete
passwordto avoid it being treated as the key password for login, which may cause the authentication to fail.Configure the oceanbase-ce component
To deploy oblogproxy, you need to create a user (
cdcro@sys) with read-only permissions for oblogproxy. Thecdcro@sysuser belongs to OceanBase Database, and oblogproxy has only the usage rights of this user.The following code shows the oceanbase-ce component configuration in the configuration file:
oceanbase-ce: servers: - name: server1 # Please don't use hostname, only IP can be supported ip: 10.10.10.1 - name: server2 ip: 10.10.10.2 - name: server3 ip: 10.10.10.3 depends: - ob-configserver global: memory_limit: 64G # The maximum running memory for an observer # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G. system_memory: 30G datafile_size: 192G # Size of the data file. log_disk_size: 192G # The size of disk space used by the clog files. enable_syslog_wf: false # Print system logs whose levels are higher than WARNING to a separate log file. The default value is true. enable_syslog_recycle: true # Enable auto system log recycling or not. The default value is false. max_syslog_file_count: 4 # The maximum number of reserved log files before enabling auto recycling. The default value is 0. # observer cluster name, consistent with obproxy's cluster_name appname: obcluster scenario: htap root_password: ******** # root user password, can be empty proxyro_password: ******** # proxyro user password, consistent with obproxy's observer_sys_password, can be empty cdcro_password: ******** # cdcro user password, consistent with oblogproxy's observer_sys_password, can be empty server1: 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. # 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 zone: zone1 server2: 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. # 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 zone: zone2 server3: 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. # 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 zone: zone3For more information about the configuration items, see the OceanBase Database section in the Configuration Item Description chapter of Configuration file description. Compared with deploying an OceanBase cluster alone, the
cdcro_passwordconfiguration item is added to the configuration file. This configuration item is used to configure the password of thecdcro@sysuser. If this configuration item is not specified, obd generates a random string.Configure the obproxy-ce and ob-configserver components
If you do not need to use the Binlog Service of oblogproxy, you can skip deploying OBProxy and obconfigserver.
The following code shows the obproxy-ce and ob-configserver component configurations in the configuration file:
obproxy-ce: 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. rpc_listen_port: 2885 home_path: /home/admin/obproxy 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 from the oceanbase-ce of the depends. ob-configserver: servers: - 10.10.10.1 global: listen_port: 8080 # The port of ob-configserver web # server_ip: 0.0.0.0 # Listen to the ob-configserver server IP. When you want to listen to the specified IP address,use it. home_path: /home/admin/ob-configserver # The working directory for prometheus. ob-configserver is started under this directory. This is a required field. ## log config # log_level: info # Log printing level of ob-configserver. The default value is `info` # log_maxsize: 30 # The total size of manager ob-configserver.Log size is measured in Megabytes.The default value is 30 # log_maxage: 7 # The days of manager expired ob-configserver.Log retention days. The default value is 7 # log_maxbackups: 10 #The number of manager expired ob-configserver.Log. The default value is 10 # log_localtime: true # Switch of ob-configserver.Log naming with localtime. The default value is true # log_compress: true # Compress ob-configserver.Log switch. The default value is true ## vip config, configserver will generate url with vip_address and port and return it to the client ## do not use some random value that can't be connected # vip_address: "10.10.10.1" # vip_port: 8080 ## storage config # storage: # database_type: sqlite3 # sqlite3 or mysql. Default sqlite3 # connection_url: "" # When database_type is set to sqlite3, the connection_url parameter can be left empty. If it is empty, the default value $home_path/.data.db?cache=shared&_fk=1 will be used. When database_type is set to mysql, the connection_url parameter must be configured, with a sample value of user:password@tcp(10.10.10.1:2883)/test?parseTime=true.For more information about the configuration items, see the ODP and obconfigserver sections in the Configuration Item Description chapter of Configuration file description.
Configure the oblogproxy component
The following code shows the oblogproxy component configuration in the configuration file:
oblogproxy: depends: - oceanbase-ce - obproxy-ce servers: - 10.10.10.1 global: home_path: /home/admin/oblogproxy service_port: 2983 # binlog_dir: /home/admin/oblogproxy/run # The directory for binlog file. The default value is $home_path/run. # binlog_mode: true # enable binlog mode, default trueThe oblogproxy component configuration depends on the oceanbase-ce and obproxy-ce components. The following table describes the configuration items.
Configuration itemRequiredDefault valueDescriptionversion Optional The latest version by default Specifies the version of the component to be deployed. Typically, you do not need to specify this configuration item. servers Required N/A For each server, you need to specify - name: server identifier (press Enter) ip: server IPor use- <ip>. If you use- <ip>, it is equivalent to- name: server IP (press Enter) ip: server IP.home_path Required N/A The installation path of oblogproxy. service_port Required 2983 The listening port of the oblogproxy service. binlog_dir Optional $home_path/run The root directory of the Binlog service. You must specify an absolute path. binlog_mode Optional true Specifies whether to enable the Binlog mode. When you use obd to deploy oblogproxy, the
binlog_dirconfiguration item in obd corresponds to thebinlog_log_bin_basenameconfiguration item of oblogproxy.When you use obd to deploy oblogproxy in Binlog mode, the default value of the
binlog_modeconfiguration item istrue.
Deploy the cluster
[admin@test001 ~]$ obd cluster deploy obtest -c distributed-with-obproxy-and-oblogproxy-example.yamlIf the network is connected, after you execute the
obd cluster deploycommand, obd checks whether the required installation package exists in the local image library. If not, obd automatically retrieves it from the YUM source.Start the cluster
[admin@test001 ~]$ obd cluster start obtestView the cluster status
[admin@test001 ~]$ obd cluster display obtest
Scenario
An OceanBase cluster already exists in the environment, and you need to use the services of oblogproxy. In this case, you can add oblogproxy to the OceanBase cluster.
Prerequisites
Before you add oblogproxy to the OceanBase cluster, ensure that obd V2.9.0 or later is installed. If obd is earlier than V2.9.0, you can upgrade it by referring to Upgrade obd or manually deploy oblogproxy.
If oblogproxy is deployed in Binlog Service mode, you need to deploy OBProxy and obconfigserver in advance.
Procedure
Here, we use the oblogproxy-component-add.yaml configuration file as an example to describe how to deploy oblogproxy.
Configure the oblogproxy component.
Here, we use the
oblogproxy-component-add.yamlconfiguration file as an example. You can define the file name as needed. The content of the configuration file is as follows:oblogproxy: depends: - oceanbase-ce servers: - 10.10.10.1 version: 2.0.0 global: home_path: /root/oblogproxy service_port: 2983 # External port. The default value is 2983.The following table describes the configuration parameters.
ParameterRequiredDefault ValueDescriptionversion Optional The latest version The version of the component to be deployed. Generally, you do not need to specify this parameter. servers Required N/A For each server, use - name: server name (line break) ip: server IPto specify it. You can also use- <ip>to specify the server. In this case,- <ip>is equivalent to- name: server IP (line break) ip: server IP.home_path Required N/A The installation path of oblogproxy. service_port Required 2983 The listening port of oblogproxy. Add oblogproxy.
[admin@test001 ~]$ obd cluster component add obtest -c oblogproxy-component-add.yamlHere, we use an existing OceanBase cluster named
obtestas an example. You need to replace it with the actual cluster name. For more information about theobd cluster component addcommand, see Cluster command groups.The command output is as follows:
Check before start oblogproxy ok start oblogproxy ok +--------------------------------+ | oblogproxy | +---------------+-------+--------+ | ip | port | status | +---------------+-------+--------+ | 10.10.10.1 | 2983 | active | +---------------+-------+--------+ obclient -h10.10.10.1 -P2983 test running Trace ID: b082e760-2889-11ef-9e33-00163e0808cc If you want to view detailed obd logs, please run: obd display-trace b082e760-2889-11ef-9e33-00163e0808ccVerify whether oblogproxy is added.
[admin@test001 ~]$ obd cluster display obtestIf the output contains the information about the oblogproxy component, it indicates that oblogproxy is successfully deployed and added to the OceanBase cluster.
Verification
Based on whether the binlog_mode is enabled, there are two verification methods.
Method 1: If
binlog_modeis set totrue, you can copy the connection string printed by obd after it starts and execute it to verify whether you can successfully connect to oblogproxy.obclient -h10.10.10.1 -P2983Method 2: If
binlog_modeis set tofalse, you can execute the following command on the server where oblogproxy is located to check if there is an oblogproxy process.ps axu | grep logproxyThe output is as follows:
admin 10493 1.1 0.0 634812 2940 ? Sl 16:21 0:07 /home/admin/oblogproxy/bin/logproxy -f /home/admin/oblogproxy/conf/conf.json admin 18071 0.0 0.0 112812 980 pts/1 S+ 16:32 0:00 grep --color=auto logproxy
References
- You can use obd to manage the deployed oblogproxy, such as starting, stopping, restarting, and destroying it. For more information about the commands, see Cluster commands. Note that when you execute the
obd cluster stopcommand to stop oblogproxy, obd stops only the oblogproxy process and does not stop the Binlog process (binlog_converter).
Note
In a full-component deployment scenario, obd automatically creates the
cdcrouser in OceanBase Database and configures it in the oblogproxy configuration file. Therefore, you do not need to configure user information when creating the Binlog service.In a minimal-component deployment scenario, if you have configured valid username and password, obd automatically configures them in the oblogproxy configuration file. Therefore, you do not need to configure user information when creating the Binlog service.
