This topic describes how to deploy the binlog service separately or deploy it together with OceanBase Database as the MetaDB.
Prerequisites
You have installed OceanBase Deployer (obd) V3.1.0 or later (latest version recommended) on your server. For more information, see Install obd.
When you install the binlog service together with OceanBase Database, the OceanBase Database version is V4.2.1.0 or later.
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. For information about how to upload installation packages to the local image repository in offline mode, see the Install obd by using an RPM package section in Install obd.
Procedure
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 and obbinlog are installed on the server.
The binlog service depends on the MetaDB. This section describes how to deploy the binlog service together with OceanBase Database as the MetaDB and deploy the binlog service separately when the MetaDB already exists.
Deploy the binlog service together with OceanBase Database as the MetaDB: You can specify information about OceanBase Database and the binlog service in the configuration file. When the binlog service is started, OceanBase Database is started as its MetaDB as configured.
Deploy the binlog service separately when the MetaDB already exists: You can use an existing OceanBase or MySQL database as the MetaDB of the binlog service.
Create a configuration file.
Run the following command to create a configuration file. Here,
distributed-binlog.yamlis used as an example, and you can customize the file name. For more information, see the Sample configuration files section in this topic.vim distributed-binlog.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 OceanBase Database 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.
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 binlog service 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.
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 the binlog service.
obd cluster deploy obbinlog -c distributed-binlog.yamlobbinlogspecifies the deployment name of the binlog service. You can use a custom name as needed. After the binlog service is deployed, the command returns a start 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 the binlog service.
obd cluster start obbinlogNote
When you start the binlog service depending on OceanBase Database, obd automatically creates a tenant named
binlogin OceanBase Database and uses theroot@binloguser as the MetaDB connection user of the binlog service.After the binlog service is started, the command returns cluster information, 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 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.
Run the following command to create a configuration file. Here,
binlog-only-example.yamlis used as an example, and you can customize the file name. For more information, see the Sample configuration files section in this topic.vim binlog-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 binlog service 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.
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 the binlog service
obd cluster deploy obbinlog -c binlog-only-example.yamlobbinlogspecifies the deployment name of the binlog service. You can use a custom name as needed. After the binlog service is deployed, the command returns a start command, as shown below:obbinlog deployed Please execute ` obd cluster start obbinlog ` to start Trace ID: f29c81bc-c729-11ef-832f-00163e14c113Start the binlog service.
obd cluster start obbinlogAfter the binlog service is started, the command returns information about the binlog service, 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
Sample configuration files
## 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 describes how to use obd to manage the binlog service. Here, the deployment name obbinlog of the binlog service is used as an example.
Stop the binlog service.
obd cluster stop obbinlogThis command stops the binlog service without affecting binlog instances. The binlog instances that are not stopped continue running.
Restart the binlog service.
obd cluster restart obbinlogThis command restarts the binlog service and binlog instances in rotating mode.
Destroy binlog instances.
obd cluster destroy obbinlogThis command destroys the binlog service, binlog instances, and binlog directories.
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 whose deployment name isobdemo. For more information, see Binlog commands.