OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Binlog Service

V4.2.5
  • Overview
  • Compatibility
  • Deployment guide
  • Configuration Information
    • Metadata
    • Local configurations
  • Control Commands
    • Overview
    • Node management
    • Task management
    • Instance management
    • Session management
    • File management
  • Monitoring and alerting
  • Troubleshooting
  • User Manual
    • Install obcdc
    • Update and upgrade
    • Performance tuning
  • Release Notes
    • Release notes
    • obbinlog V4.2.5
    • obbinlog V4.2.4
    • obbinlog V4.2.3
    • obbinlog V4.2.1
    • obbinlog V4.2.0
    • obbinlog Community Edition V4.0.1

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Binlog Service
  3. V4.2.5

Task management

Last Updated:2026-09-03 10:36:38

Create a binlog task
Syntax
Parameters
Example
Query a binlog task
Syntax
Modify a binlog task
Syntax
Parameters
Example
Release a binlog task
Syntax
Examples

Create a binlog task

You can enable the binlog service for the specified OceanBase Database tenant. Then, the binlog server will asynchronously create N binlog instances for the tenant. After you execute the CREATE BINLOG statement, resources will be allocated. If the resource allocation is successful, an OK message is immediately returned. If less than N binlog instances are successfully created, a warning message is returned.

Syntax

CREATE BINLOG [IF NOT EXISTS] FOR TENANT cluster.tenant 
       [FROM timestamp] [TO USER user PASSWORD pwd] 
       WITH CLUSTER URL cluster_url [, binlog_option [, binlog_option...]];

binlog_option:
      INITIAL_TRX_XID
    | INITIAL_TRX_GTID_SEQ
    | REPLICATE NUM
    | SERVER UUID

Parameters

Parameter
Description
IF NOT EXISTS Optional. If you specify IF NOT EXISTS and the binlog task to be created already exists, the system does not report an error or create the task again. If you do not specify this parameter and the binlog task to be created already exists, the system reports an error.
cluster.tenant The name of the tenant for which the binlog task is to be created, and the name of the cluster to which the tenant belongs.
timestamp Optional. The startup timestamp. If you do not specify this parameter, the binlog task starts from the current timestamp.
user Optional. The username of a user in the sys tenant of the OceanBase cluster. If you have specified the username and password of a user in the sys tenant when you start the binlog server, skip this parameter.
pwd Optional. The password of the user specified by user in the sys tenant. If you have specified the username and password of a user in the sys tenant when you start the binlog server, skip this parameter.
cluster_url The ConfigUrl of the OceanBase cluster, which must be enclosed in quotation marks. You can obtain the value of this parameter by executing the SHOW PARAMETERS LIKE 'obconfig_url'; statement.
binlog_option Optional. Options of the binlog task, which are separated with commas (,). Separate the options and the ConfigUrl with a comma (,). Valid values:
  • INITIAL_TRX_XID: the xid that uniquely identifies the start transaction.
  • INITIAL_TRX_GTID_SEQ: the global transaction ID (GTID) of the start transaction.
  • REPLICATE NUM: 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 primary instance.
  • SERVER UUID: the UUID of the binlog server.

Example

Create a binlog task for the test1 tenant in the obdemo cluster and create three binlog instances for the tenant.

CREATE BINLOG FOR TENANT `obdemo`.`test1` 
       TO USER `root` PASSWORD `********` 
       WITH CLUSTER URL `http://10.10.10.1:8080/services?Action=ObRootServiceInfo&ObCluster=demo`
       , REPLICATE NUM 3;

Query a binlog task

You can query the binlog files and resource metrics of the primary binlog instance in a binlog task. If the primary binlog instance is unavailable, an empty result set is returned.

Syntax

SHOW BINLOG STATUS [FOR TENANT cluster.tenant];

cluster.tenant specifies the name of the tenant whose binlog task is to be queried and the name of the cluster to which the tenant belongs. If you directly execute SHOW BINLOG STATUS without specifying FOR TENANT cluster.tenant, which is optional, information about the primary binlog instances of all binlog tasks is returned. If you specify FOR TENANT cluster.tenant, information about the primary binlog instance of the specified tenant is returned. Here is an example:

SHOW BINLOG STATUS FOR TENANT obdemo.test1;

The output is as follows:


+-----------+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| cluster   | tenant | status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
+-----------+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| obdemo    | test1  | {"binlog_instance":"gldwt7bnco","resources_metrics":{"client_id":"/home/admin/oblogproxy/run/gldwt7bnco","fd_count":78,"pid":12058,"cpu_status":{"cpu_count":8,"cpu_used_ratio":0.006535947788506746},"disk_status":{"disk_total_size_mb":307048,"disk_usage_size_process_mb":0,"disk_used_ratio":0.0,"disk_used_size_mb":78830},"memory_status":{"mem_total_size_mb":63882,"mem_used_ratio":0.016514824703335763,"mem_used_size_mb":1055},"network_status":{"network_rx_bytes":288853,"network_wx_bytes":289725}},"binlog_files":[{"binlog_name":"mysql-bin.000001","binlog_size":155}]}      |
+-----------+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

The following table describes the columns in the result set.

Column
Description
cluster The name of the cluster.
tenant The name of the tenant.
status Information about the primary binlog instance.

Modify a binlog task

You can modify the parameter settings for all binlog instances of the specified tenant. The new settings also take effect for binlog instances created later.

Syntax

ALTER BINLOG cluster.tenant 
      SET binlog_instance_option [, binlog_instance_option...];

binlog_instance_option:
      BINLOG_EXPIRE_LOGS_SECONDS
    | BINLOG_EXPIRE_LOGS_SIZE
    | FAILOVER
    | EXTRA_OBCDC_CFG

Parameters

Parameter
Description
cluster.tenant The name of the tenant for which the binlog instance parameter settings are to be modified, and the name of the cluster to which the tenant belongs.
binlog_instance_option The binlog instance parameters to be modified, which are separated with commas (,). Valid values:
  • BINLOG_EXPIRE_LOGS_SECONDS: the validity period of binlog files. The default value is 259,200 seconds. A binlog file automatically becomes invalid after the validity period elapses.
  • BINLOG_EXPIRE_LOGS_SIZE: the maximum size of a binlog file. The default value is 53687091200 bytes.
  • FAILOVER: specifies whether to automatically recover the binlog instance after it fails. The default value is 1, which indicates automatic recovery.
  • EXTRA_OBCDC_CFG: the OceanBase Change Data Capture (obcdc) parameter settings of the binlog instance.

Example

ALTER BINLOG obdemo.test1 SET BINLOG_EXPIRE_LOGS_SECONDS = 518400;

Release a binlog task

You can stop all binlog instances of the specified tenant and drop generated binlog files.

Syntax

DROP BINLOG [IF EXISTS] FOR TENANT cluster.tenant;

cluster.tenant specifies the name of the tenant whose binlog task is to be released and the name of the cluster to which the tenant belongs.

Examples

Release the binlog task of the test1 tenant in the obdemo cluster.

DROP BINLOG FOR TENANT obdemo.test1;

Previous topic

Node management
Last

Next topic

Instance management
Next
on this page
Create a binlog task
Syntax
Parameters
Example
Query a binlog task
Syntax
Modify a binlog task
Syntax
Parameters
Example
Release a binlog task
Syntax
Examples