When you deploy obbinlog, you can choose to deploy it separately or together with OceanBase Database as the MetaDB. This topic describes how to perform these operations.
Note
Currently, obd supports only managing the Binlog service Community Edition V4.0.1 and later and the Binlog service Enterprise Edition V4.3.2 and later.
Binlog service Community Edition supports only OceanBase Database Community Edition, and Binlog service Enterprise Edition supports only OceanBase Database Enterprise Edition in MySQL mode. Deploy the appropriate obbinlog based on your requirements.
Prerequisites
You have installed V3.1.0 or later of obd. We recommend that you install the latest version. For more information, see Install obd.
Note
obd V4.0.0 and later support the deployment of Enterprise Edition obbinlog V4.3.2 and later. To deploy Enterprise Edition obbinlog, you must install obd V4.0.0 or later.
If you deploy an OceanBase cluster as a MetaDB, make sure that the OBServer node supports the AVX instruction set (this restriction applies only to servers with the x86 architecture). You can execute 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 OceanBase Database version to be deployed falls into the following ranges, the AVX instruction set is no longer required:
- 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 as a MetaDB and use servers with the ARM architecture, 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, download the OceanBase Database installation package with thenonlseoption and use 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.If you deploy obbinlog by relying on OceanBase Database, the OceanBase Database version must be V4.2.1.0 or later.
Your machine can connect to the Internet, or the local image library of obd contains the installation package required for deployment.
You can execute the
obd mirror list localcommand to check the installation packages in the local image library. For information about how to upload the installation package to the local image library in an offline scenario, see the Install obd by using RPM section in Install obd.Note
The Enterprise Edition obbinlog package is not available in the remote image library of obd. To deploy Enterprise Edition obbinlog, make sure that the local image library of obd contains the required installation package.
Procedure
Note
This topic assumes that the server can access the public network or has the required software (such as OceanBase Database and obbinlog) installed.
You can deploy the Binlog service in two ways: Deploy obbinlog and MetaDB (OceanBase Database) and Deploy obbinlog with an existing MetaDB. This topic describes both methods:
Deploy obbinlog and MetaDB (OceanBase Database): You can configure both OceanBase Database and obbinlog in the configuration file. When you start obbinlog, it will start OceanBase Database as the MetaDB for the Binlog service.
Deploy obbinlog with an existing MetaDB: You need to ensure that an OceanBase Database or MySQL database is available as the MetaDB for the Binlog service.
Create a configuration file.
Execute the following command to create a configuration file. Here, we use
distributed-binlog.yamlas an example. You can customize the file name as needed. For the complete content of the configuration file, see Configuration file example below.vim distributed-binlog.yamlModify the user information.
You can copy the following content and modify it based on your actual scenario.
## 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 30usernameis the username for logging in to the target server. Ensure that your username has write permissions for the home directory.passwordandkey_fileare both used to verify the user. Usually, you only need to fill in one of them.Notice
After configuring the key path, if your key does not require a password, please comment out or delete
passwordto avoid it being considered as the key password for login, which may cause verification failure.Modify the OceanBase Database configuration.
You can copy the following content and modify it based on your actual scenario. For detailed descriptions of OceanBase Database configuration items, see Configuration file description under Configuration item description.
oceanbase-ce: version: 4.3.3.0 # release: 100000242024032211.el7 # package_hash: c4a03c83614f50c99ddb1c37dda858fa5d9b14b7 servers: - name: server1 ip: 10.10.10.1 global: mysql_port: 2881 rpc_port: 2882 home_path: /home/admin/oceanbase obshell_port: 2886 scenario: htap log_disk_size: 20G datafile_size: 20GB production_mode: false enable_syslog_recycle: true enable_syslog_wf: false max_syslog_file_count: 4 root_password: ******** zone: zone1Modify the obbinlog configuration.
You can copy the following content and modify it based on your actual scenario. For the specific meanings of the configuration items, see Configuration file description under Configuration item description.
obbinlog-ce: depends: - oceanbase-ce servers: - name: server1 ip: 10.10.10.1 - name: server2 ip: 10.10.10.2 global: home_path: /home/admin/obbinlog service_port: 2983 # External port. The default value is 2983. prometheus_port: 2984 # The Prometheus port. The default value is 2984. init_schema: trueDeploy obbinlog.
obd cluster deploy obbinlog -c distributed-binlog.yamlIn the command,
obbinlogis the deployment name of obbinlog. You can customize the deployment name as needed. After the deployment is successful, the command line will output the corresponding startup command, as shown below:obbinlog deployed Please execute ` obd cluster start obbinlog ` to start Trace ID: b524a336-c748-11ef-ab02-00163e14c113 If you want to view detailed obd logs, please run: obd display-trace b524a336-c748-11ef-ab02-00163e14c113Start obbinlog.
obd cluster start obbinlogNote
When starting obbinlog with OceanBase Database, obd will automatically create a
binlogtenant in OceanBase Database and set theroot@binloguser as the connection user for the Binlog service MetaDB.After the startup is successful, the cluster information will be output, as shown below:
Wait for observer init ok +-------------------------------------------------+ | oceanbase-ce | +---------------+---------+------+-------+--------+ | ip | version | port | zone | status | +---------------+---------+------+-------+--------+ | 10.10.10.1 | 4.3.3.0 | 2881 | zone1 | ACTIVE | +---------------+---------+------+-------+--------+ obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A cluster unique id: f15c503b-a8e2-50b2-a027-ee1d11886199-1941b9f2469-00030304 +-----------------------------------------+ | obbinlog-ce | +---------------+---------+------+--------+ | ip | version | port | status | +---------------+---------+------+--------+ | 10.10.10.1 | 4.0.1 | 2983 | active | +---------------+---------+------+--------+ obclient -h10.10.10.1 -P2983 obshell program health check ok display obshell dashboard ok +-----------------------------------------------------------+ | obshell Dashboard | +---------------------------+------+---------------+--------+ | url | user | password | status | +---------------------------+------+---------------+--------+ | http://10.10.10.1:2886 | root | '********' | active | +---------------------------+------+---------------+--------+ obbinlog running Trace ID: b5140f16-c749-11ef-809a-00163e14c113 If you want to view detailed obd logs, please run: obd display-trace b5140f16-c749-11ef-809a-00163e14c113
Create a configuration file.
Execute the following command to create a configuration file. Here, we use
binlog-only-example.yamlas an example. You can customize the file name as needed. For the complete content of the configuration file, see Configuration file example below.vim binlog-only-example.yamlModify the user information.
You can copy the following content and modify it based on your actual scenario.
## 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 30usernameis the username for logging in to the target server. Ensure that your username has write permissions for the home directory.passwordandkey_fileare both used to verify the user. Usually, you only need to fill in one of them.Notice
After configuring the key path, if your key does not require a password, please comment out or delete
passwordto avoid it being considered as the key password for login, which may cause verification failure.Modify the obbinlog configuration.
You can copy the following content and modify it based on your actual scenario. For the specific meanings of the configuration items, see Configuration file description under Configuration item description.
obbinlog-ce: version: 4.0.1 servers: - name: server1 ip: 10.10.10.1 - name: server2 ip: 10.10.10.2 global: home_path: /home/admin/obbinlog service_port: 2983 # External port. The default value is 2983. prometheus_port: 2984 # The Prometheus port. The default value is 2984. init_schema: true # init meta db, default true meta_host: 10.10.10.1 # meta support ob/mysql meta_port: 2883 meta_username: root@binlog # need tenant exist, if db is mysql, use root or other meta_password: ****** meta_db: binlog_databaseDeploy obbinlog.
obd cluster deploy obbinlog -c binlog-only-example.yamlIn the command,
obbinlogis the deployment name of obbinlog. You can customize the deployment name as needed. After the deployment is successful, the command line will output the corresponding startup command, as shown below:obbinlog deployed Please execute ` obd cluster start obbinlog ` to start Trace ID: f29c81bc-c729-11ef-832f-00163e14c113Start obbinlog.
obd cluster start obbinlogAfter the startup is successful, the obbinlog information will be output, as shown below:
Get local repositories ok Load cluster param plugin ok Open ssh connection ok wait observer usable ok start obbinlog-ce ok obbinlog-ce program health check ok Connect to obbinlog-ce 10.10.10.1:2983 ok +-----------------------------------------+ | obbinlog-ce | +---------------+---------+------+--------+ | ip | version | port | status | +---------------+---------+------+--------+ | 10.10.10.1 | 4.0.1 | 2983 | active | +---------------+---------+------+--------+ obclient -h10.10.10.1 -P2983 obbinlog running Trace ID: 3ee817e8-c72a-11ef-a900-00163e14c113 If you want to view detailed obd logs, please run: obd display-trace 3ee817e8-c72a-11ef-a900-00163e14c113
Configuration file example
## 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 30
oceanbase-ce:
version: 4.3.3.0
# release: 100000242024032211.el7
# package_hash: c4a03c83614f50c99ddb1c37dda858fa5d9b14b7
servers:
- name: server1
ip: 10.10.10.1
global:
mysql_port: 2881
rpc_port: 2882
home_path: /home/admin/oceanbase
obshell_port: 2886
scenario: htap
log_disk_size: 20G
datafile_size: 20GB
production_mode: false
enable_syslog_recycle: true
enable_syslog_wf: false
max_syslog_file_count: 4
root_password: ********
zone: zone1
obbinlog-ce:
depends:
- oceanbase-ce
servers:
- name: server1
ip: 10.10.10.1
- name: server2
ip: 10.10.10.2
global:
home_path: /home/admin/obbinlog
service_port: 2983 # External port. The default value is 2983.
prometheus_port: 2984 # The Prometheus port. The default value is 2984.
init_schema: true
## 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 30
obbinlog-ce:
version: 4.0.1
servers:
- name: server1
ip: 10.10.10.1
- name: server2
ip: 10.10.10.2
global:
home_path: /home/admin/obbinlog
service_port: 2983 # External port. The default value is 2983.
prometheus_port: 2984 # The Prometheus port. The default value is 2984.
init_schema: true # init meta db, default true
meta_host: 10.10.10.1 # meta support ob/mysql
meta_port: 2883
meta_username: root@binlog # need tenant exist, if db is mysql, use root or other
meta_password: ******
meta_db: binlog_database
Related operations
This section uses obbinlog as the deployment name of obbinlog in obd to describe how to use obd to manage the Binlog service.
Stop obbinlog
obd cluster stop obbinlogThis command stops obbinlog without affecting the Binlog instance. The Binlog instance that is not stopped continues to run.
Restart obbinlog
obd cluster restart obbinlogThis command restarts obbinlog and the Binlog instance.
Destroy the Binlog instance
obd cluster destroy obbinlogThis command stops obbinlog and the Binlog instance and destroys the Binlog service directory.
Create a Binlog instance
obd binlog create obbinlog obdemo ob_mysql --replicate-num=3This command creates three Binlog instances for the
ob_mysqltenant in the cluster with the deployment nameobdemo. For more information about the commands of the Binlog service, see Binlog service commands.Upgrade obbinlog
obd cluster upgrade obbinlog -c obbinlog-ce -V 4.2.0Starting from V3.2.0, obd supports upgrading obbinlog to V4.2.0 or later. This command upgrades the obbinlog version and upgrades the Binlog instance.
