SHOW SLAVE STATUS returns the status of one or all primary/secondary replication links created by CHANGE MASTER TO. Use it to check replication health, diagnose lag, and inspect replication positions.
Syntax
SHOW SLAVE STATUS [ channel_option ]
channel_option:
FOR CHANNEL channelSLAVE and REPLICA are interchangeable in this statement. SHOW REPLICA STATUS produces identical results.
Usage notes
Run this statement with a privileged account on the current instance.
With
FOR CHANNEL channel: returns status for the named replication link only.Without
FOR CHANNEL: returns status for all primary/secondary replication links on the current instance.
Example
The following statement returns the status of a replication link named aaa:
SHOW SLAVE STATUS FOR CHANNEL 'aaa';Output:
SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Master_Host: 127.0.0.1
Master_User: polardbxtest
Master_Port: 3036
Master_Log_File: binlog.000001
Read_Master_Log_Pos: 17300738
Relay_Log_File: binlog.000001
Relay_Log_Pos: 17300738
Relay_Master_Log_File: binlog.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Error:
Exec_Master_Log_Pos: 17300738
Exec_Master_Log_Tso: 7186584608278839360
Until_Condition: None
Master_SSL_Allowed: No
Seconds_Behind_Master: 27
Master_SSL_Verify_Server_Cert: No
Replicate_Ignore_Server_Ids:
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Yes
Auto_Position: 0
Replicate_Rewrite_DB:
Replicate_Mode: INCREMENTAL
Running_Stage: REPLICA_INC_CATCH_UP
Replicate_Enable_Ddl: true
Skip_Tso:
Skip_Until_Tso:
Write_Type: SPLIT
Conflict_Strategy: OVERWRITE
Source_Stream_Group_Name:
Channel_Name: aaa
Sub_Channel_Name: 1
1 row in set (0.01 sec)Output field reference
Replication thread status
| Field | Description |
|---|---|
Slave_IO_Running | Whether the I/O thread that reads events from the source is running. Yes means the thread is active and connected. No means the thread has stopped. |
Slave_SQL_Running | Whether the SQL thread that applies events to the local instance is running. Yes means the thread is active. No means the thread has stopped. |
Slave_SQL_Running_State | Current state of the SQL thread. Yes means the thread is running normally. No means the thread is not running. |
Replication position
| Field | Description |
|---|---|
Relay_Master_Log_File | The binlog file on the source that contains the current replication position. |
Read_Master_Log_Pos | The position in Relay_Master_Log_File up to which the I/O thread has read. |
Exec_Master_Log_Pos | The position in Relay_Master_Log_File up to which the SQL thread has applied events. |
Exec_Master_Log_Tso | The upstream Timestamp Oracle (TSO) value corresponding to the current replication position. This is a PolarDB for Xscale extension. |
Replication delay
| Field | Description |
|---|---|
Seconds_Behind_Master | The replication delay in seconds — the difference between the timestamp of the event being applied and the current time on the replica. 0 means replication is caught up. NULL means the SQL thread is not running. |
SQL_Remaining_Delay | When CHANGE MASTER TO MASTER_DELAY is set, the number of seconds remaining before the delayed event is applied. NULL when no delay is configured. |
PolarDB for Xscale-specific fields
| Field | Description |
|---|---|
Replicate_Mode | The replication mode. INCREMENTAL means the link applies incremental changes from the source. |
Running_Stage | The current operational stage of the replication link. REPLICA_INC_CATCH_UP means the replica is catching up with the source through incremental replication. |
Write_Type | How replicated data is written to the replica. SPLIT distributes write operations for parallel processing. |
Conflict_Strategy | How write conflicts are resolved when the same row is modified on both sides. OVERWRITE means the incoming change overwrites the existing data. |
Sub_Channel_Name | The sub-channel identifier within the named channel. |
Error information
| Field | Description |
|---|---|
Last_Error | The most recent error reported for this replication link. An empty value means no errors have occurred. |
Channel identification
| Field | Description |
|---|---|
Channel_Name | The name of the replication channel, as specified in CHANGE MASTER TO. |
Fields from CHANGE MASTER TO
The following fields reflect the configuration set by CHANGE MASTER TO. Refer to that statement's documentation for field definitions.
Master_HostMaster_UserMaster_PortMaster_Log_FileWrite_TypeReplicate_ModeConflict_StrategyReplicate_Ignore_Server_IdsSource_Stream_Group_NameChannel_Name
Fields from CHANGE REPLICATION FILTER
The following fields reflect the filter rules set by CHANGE REPLICATION FILTER. Refer to that statement's documentation for field definitions.
Replicate_Do_DBReplicate_Ignore_DBReplicate_Do_TableReplicate_Ignore_TableReplicate_Wild_Do_TableReplicate_Wild_Ignore_TableReplicate_Enable_DdlSkip_TsoSkip_Until_Tso