This topic describes how to execute the SHOW MASTER STATUS statement to query information about the binary log files of a primary PolarDB-X instance.
Syntax
SHOW [FULL] 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 a
WITH
clause is not added to the SQL statement, you can view information about binary log files of a primary instance. The binary log files are generated in single-stream mode.If a
WITH
clause is added to the SQL statement, you can view information about binary log files of a primary instance. The binary log files are generated in a specific stream in multi-stream mode.For PolarDB-X instances whose kernel version is V5.4.18 or later, you can specify the FULL parameter to query more details about the binary log files.
For more information about the SQL statement, see SHOW MASTER STATUS.
Example 1
Execute the following statement:
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 view information about binary log files of a primary instance. The binary log files are generated in the group1_stream_0 stream in multi-stream mode.
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 | | | |
+-------------------------------+----------+--------------+------------------+-------------------+
Example 3
Execute the following statement:
SHOW FULL MASTER STATUS \G;
The following result is returned:
show full master status \G;
*************************** 1. row ***************************
FILE: binlog.000655
POSITION: 6889
LASTTSO: 718587571090751494417169409264603668500000000000000000
DELAYTIMEMS: 210
AVGREVEPS: 0
AVGREVBPS: 0
AVGWRITEEPS: 0
AVGWRITEBPS: 199
AVGWRITETPS: 0
AVGUPLOADBPS: 199
AVGDUMPBPS: 219
EXTINFO:
The following parameters are returned:
LASTTSO: the TSO of the last transaction in the binary log files.
DELAYTIMEMS: the binary log delay.
AVGWRITEEPS: the number of events that are written to the binary log files per second.
AVGWRITEBPS: the number of bytes that are written to the binary log files per second.
AVGWRITETPS: the number of transactions that are written to the binary log files per second.
AVGUPLOADBPS: the number of bytes of binary log files that are uploaded to the remote storage per second.
AVGDUMPBPS: the number of bytes of binlog dump per second.