The binlog service collects transaction logs of OceanBase Database and converts them into MySQL binlogs. This service is designed for scenarios such as real-time data subscription. For more information, see the OceanBase Binlog Service documentation.
You can specify the -h/--help option in a command to query its help information. You can also specify the -v/--verbose option to query the execution details of a command that returns an error.
Note
The business tenant in this topic is an OceanBase Database tenant for which binlog files are to be generated.
The cluster name and deployment name in this topic are names returned by the
obd cluster listcommand. If the cluster where the business tenant resides is not managed by OceanBase Deployer (obd), you can take over the cluster to obd. For more information, see Use obd to take over a cluster.
obd binlog create
You can run this command to create a binlog instance for the specified tenant.
obd binlog create <binlog deploy name> <oceanbase deploy name> <oceanbase tenant> [options]
# example
obd binlog create binlog_1 obdemo ob_mysql --replicate-num=3
binlog deploy name specifies the deployment name of the binlog service. oceanbase deploy name specifies the name of the cluster where the business tenant resides. oceanbase tenant specifies the name of the business tenant.
The following table describes the options in the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| --replicate-num | No | int | 1 | The number of binlog instance replicas of the tenant. When the value is greater than 1, the binlog service randomly selects an instance replica as the leader instance. |
| -d/--odp/--obproxy-deployname | No | string | ob_deployname | The name of the deployed cluster where the OceanBase Database Proxy (ODP) associated with the business tenant resides. This parameter is required only when the ODP and the business cluster belong to different deployed clusters. |
| -p/--cdcro-password | No | string | Empty | The password of the cdcro user in the sys tenant. This parameter is required only if you have manually created a cdcro user.
NoteIf no |
obd binlog drop
You can run this command to stop all binlog instances in the specified tenant and drop generated binlog files. It is equivalent to the DROP BINLOG FOR TENANT <cluster>.<tenant>; command in the binlog service.
obd binlog drop <binlog deploy name> <oceanbase deploy name> <oceanbase tenant> [options]
# example
obd binlog drop binlog_1 obdemo ob_mysql
binlog deploy name specifies the deployment name of the binlog service. oceanbase deploy name specifies the name of the cluster where the business tenant resides. oceanbase tenant specifies the name of the business tenant.
obd binlog show
You can run this command to list the binlog instances. It is equivalent to the SHOW BINLOG INSTANCES FOR <cluster>.<tenant>; command in the binlog service.
obd binlog show <deploy name> [options]
# example
obd binlog show binlog_1 -d obdemo -t ob_mysql
deploy name specifies the deployment name of the binlog service.
The following table describes the options in the command.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -d/--deploy-name | No | string | Empty | The deployment name of the business cluster. |
| -t/-n/--tenant_name | No | string | Empty | The name of the business tenant. |
Note
You can specify both or neither of the two options in this command. If you specify only one of them, an error will be returned.
obd binlog start
You can run this command to start all binlog instances in the specified tenant.
obd binlog start <binlog deploy name> <oceanbase deploy name> <oceanbase tenant> [options]
# example
obd binlog start binlog_1 obdemo ob_mysql
binlog deploy name specifies the deployment name of the binlog service. oceanbase deploy name specifies the name of the cluster where the business tenant resides. oceanbase tenant specifies the name of the business tenant.
obd binlog stop
You can run this command to stop all binlog instances in the specified tenant.
obd binlog stop <binlog deploy name> <oceanbase deploy name> <oceanbase tenant> [options]
# example
obd binlog stop binlog_1 obdemo ob_mysql
binlog deploy name specifies the deployment name of the binlog service. oceanbase deploy name specifies the name of the cluster where the business tenant resides. oceanbase tenant specifies the name of the business tenant.