This topic describes how to execute the SHOW MASTER STATUS statement to query information about the binary log files of a PolarDB-X instance as the source.

Syntax

SHOW MASTER STATUS [WITH stream_name]

Usage notes

  • Before you execute the preceding SQL statement, make sure that your account is granted the SUPER or REPLICATION CLIENT permission. For information about how to manage permissions, see Manage accounts and permissions.
  • If the SQL statement does not contain a WITH clause, the information about the binary log files generated in single-stream mode is returned.
  • If the SQL statement contains a WITH clause, the information about the binary log files generated for the specified stream in multi-stream mode is returned.
  • For more information about the SQL statement, see SHOW MASTER STATUS.

Example 1

Execute the following statement to query information about the binary log files generated in single-stream mode:

SHOW MASTER STATUS;

The following result is returned:

*************************** 1. row ***************************
             FILE: binlog.000001
         POSITION: 4
     BINLOG_DO_DB:
 BINLOG_IGNORE_DB:
EXECUTED_GTID_SET:

Example 2

Execute the following statement to query information about the binary log files generated for the group1_stream_0 stream:

SHOW MASTER STATUS WITH 'group1_stream_0';

The following result is returned:

+-------------------------------+----------+--------------+------------------+-------------------+
| FILE                          | POSITION | BINLOG_DO_DB | BINLOG_IGNORE_DB | EXECUTED_GTID_SET |
+-------------------------------+----------+--------------+------------------+-------------------+
| group1_stream_0#binlog.000001 |  3626808 |              |                  |                   |
+-------------------------------+----------+--------------+------------------+-------------------+