The binlog service provides SQL statements for you to manage binlog tasks, instances, and files.
The management statements of the binlog service must be executed on the binlog server and are categorized as follows:
- Node management statements: These statements are used for managing binlog nodes, such as querying all OBServer nodes where the binlog service resides and querying information about the node where the primary binlog instance of the specified tenant resides.
- Task management statements: These statements are used for managing binlog tasks, such as creating, querying, modifying, and releasing tasks. Tenants and binlog tasks are in one-to-one correspondence. In other words, you can create only one binlog task for each tenant.
- Instance management statements: These statements are used for managing binlog instances, such as creating, querying, modifying, and starting/stopping instances, and switching the primary instance. Binlog tasks and binlog instances are in one-to-many correspondence. In other words, you can create multiple binlog instances in one binlog task.
- Session management statements: These statements are used for managing binlog sessions, such as querying and deleting sessions.
- File management statements: At present, only the
PURGE BINARY LOGSstatement is supported for you to purge binlog files.
The following table describes the management statements provided by the binlog service. Click the name of each statement category to access the relevant documentation.
| Category | Statement | Description |
|---|---|---|
| Node management | SHOW NODES | Queries all OBServer nodes where the binlog service resides. |
| SHOW BINLOG SERVER | Queries information about the node where the primary binlog instance of the specified tenant resides. If no primary binlog instance is available, an error message is returned. | |
| Task management | CREATE BINLOG | Enables the binlog service for the specified OceanBase Database tenant. Then, the binlog server will asynchronously create N binlog instances for the tenant. |
| SHOW BINLOG STATUS | Queries 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. | |
| ALTER BINLOG | Modifies the parameter settings for all binlog instances of the specified tenant. The new settings also take effect for binlog instances created later. | |
| DROP BINLOG | Stops all binlog instances of the specified tenant and drops generated binlog files. | |
| Instance management | CREATE BINLOG INSTANCE | Creates a binlog instance for a tenant with the binlog service enabled. |
| SHOW BINLOG INSTANCES | Queries information about one or more binlog instances. If no record meeting the specified conditions exists, an empty result set is returned. | |
| ALTER BINLOG INSTANCE | Modifies the parameter settings of the specified binlog instance. | |
| STOP BINLOG INSTANCE | Stops the specified binlog instance. | |
| START BINLOG INSTANCE | Starts the specified binlog instance. | |
| SWITCH MASTER INSTANCE | Switches the primary binlog instance of the specified tenant. | |
| DROP BINLOG INSTANCE | Drops the specified binlog instance, as well as its binlog files. | |
| Session management | SHOW [FULL] PROCESSLIST | Queries the connection sessions on the specified binlog instance. |
| KILL | Terminates a connection session on the specified binlog instance. | |
| File management | PURGE BINARY LOGS | Purges specified binlog files. |