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.

ADMIN [SET|SHOW|UNSET] BDR ROLE - 图1

Warning

This feature is experimental. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an issue on GitHub.

Synopsis

AdminShowBDRRoleStmt

ADMIN [SET|SHOW|UNSET] BDR ROLE - 图2

AdminSetBDRRoleStmt

ADMIN [SET|SHOW|UNSET] BDR ROLE - 图3

AdminUnsetBDRRoleStmt

ADMIN [SET|SHOW|UNSET] BDR ROLE - 图4

  1. AdminShowBDRRoleStmt ::=
  2. 'ADMIN' 'SHOW' 'BDR' 'ROLE'
  3. AdminSetBDRRoleStmt ::=
  4. 'ADMIN' 'SET' 'BDR' 'ROLE' ('PRIMARY' | 'SECONDARY')
  5. AdminUnsetBDRRoleStmt ::=
  6. '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.

  1. ADMIN SHOW BDR ROLE;
  1. +------------+
  2. | BDR_ROLE |
  3. +------------+
  4. | |
  5. +------------+
  6. 1 row in set (0.01 sec)

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

  1. ADMIN SET BDR ROLE PRIMARY;
  1. Query OK, 0 rows affected (0.01 sec)
  1. ADMIN SHOW BDR ROLE;
  2. +----------+
  3. | BDR_ROLE |
  4. +----------+
  5. | primary |
  6. +----------+
  7. 1 row in set (0.00 sec)

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

  1. ADMIN UNSET BDR ROLE;
  1. Query OK, 0 rows affected (0.01 sec)
  1. ADMIN SHOW BDR ROLE;
  2. +----------+
  3. | BDR_ROLE |
  4. +----------+
  5. | |
  6. +----------+
  7. 1 row in set (0.01 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.