Skip to content

Latest commit

 

History

History
84 lines (64 loc) · 1.7 KB

sql-statement-admin-bdr-role.md

File metadata and controls

84 lines (64 loc) · 1.7 KB
title summary
ADMIN [SET|SHOW|UNSET] BDR ROLE
An overview of the usage of ADMIN [SET|SHOW|UNSET] BDR ROLE for the TiDB database.

ADMIN [SET|SHOW|UNSET] BDR ROLE

  • Use ADMIN SET BDR ROLE to set the BDR role of the cluster. Currently, you can set the following BDR roles for a TiDB cluster: PRIMARY and SECONDARY. For more information about BDR roles, see DDL Synchronization in TiCDC Bidirectional Replication.
  • Use ADMIN SHOW BDR ROLE to show the BDR role of the cluster.
  • Use ADMIN UNSET BDR ROLE to unset the BDR role of the cluster.

Synopsis

AdminShowBDRRoleStmt ::=
    'ADMIN' 'SHOW' 'BDR' 'ROLE'

AdminSetBDRRoleStmt ::=
    'ADMIN' 'SET' 'BDR' 'ROLE' ('PRIMARY' | 'SECONDARY')

AdminUnsetBDRRoleStmt ::=
    'ADMIN' 'UNSET' 'BDR' 'ROLE'

Examples

By default, a TiDB cluster has no BDR role. Run the following command to show the BDR role of the cluster.

ADMIN SHOW BDR ROLE;
+------------+
| BDR_ROLE   |
+------------+
|            |
+------------+
1 row in set (0.01 sec)

Run the following command to set the BDR role to PRIMARY.

ADMIN SET BDR ROLE PRIMARY;
Query OK, 0 rows affected (0.01 sec)
ADMIN SHOW BDR ROLE;
+----------+
| BDR_ROLE |
+----------+
| primary  |
+----------+
1 row in set (0.00 sec)

Run the following command to unset the BDR role of the cluster.

ADMIN UNSET BDR ROLE;
Query OK, 0 rows affected (0.01 sec)
ADMIN SHOW BDR ROLE;
+----------+
| BDR_ROLE |
+----------+
|          |
+----------+
1 row in set (0.01 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.