All Products
Search
Document Center

PolarDB:SHOW SLAVE STATUS

Last Updated:Jun 06, 2024

This topic describes how to execute the SHOW SLAVE STATUS statement to view the status of the primary/secondary replication links that are created by executing the CHANGE MASTER TO statement.

Syntax

SHOW SLAVE STATUS [ channel_option ]

channel_option:
    FOR CHANNEL channel

Usage notes

  • You must use a privileged account of the current instance to execute this SQL statement.

  • If the channel_option parameter is specified, this statement takes effect only on the specified primary/secondary replication link. If the channel_option parameter is not specified, this statement takes effect on all primary/secondary replication links of the current instance.

  • You can replace SLAVE with REPLICA in this statement. The semantics remain unchanged.

Example

Execute the following statement to view the status of the primary/secondary replication link whose name is aaa that is created by executing the CHANGE MASTER TO statement:

SHOW SLAVE STATUS for channel 'aaa';

The following result is returned:

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)

The following section describes the parameters in the returned result. Only the parameters that you need to pay attention to are described.

  • For more information about the following parameters, see CHANGE MASTER TO.

    • Master_Host

    • Master_User

    • Master_Port

    • Master_Log_File

    • Write_Type

    • Replicate_Mode

    • Conflict_Strategy

    • Replicate_Ignore_Server_Ids

    • Source_Stream_Group_Name

    • Channel_Name

  • The following parameters indicate the replication location of the primary/secondary replication link:

    • Relay_Master_Log_File: the name of the file to which the current replication offset belongs.

    • Read_Master_Log_Pos: the offset in the file to which the current replication offset belongs.

    • Exec_Master_Log_Pos: the offset in the file to which the current replication offset belongs.

    • Exec_Master_Log_Tso: the upstream TSO corresponding to the current replication offset.

  • The following parameter indicates the status of the primary/secondary replication link:

    Slave_SQL_Running_State: {Yes|No}

  • For more information about the following parameters, see CHANGE REPLICATION FILTER.

    • Replicate_Do_DB

    • Replicate_Ignore_DB

    • Replicate_Do_Table

    • Replicate_Ignore_Table

    • Replicate_Wild_Do_Table

    • Replicate_Wild_Ignore_Table

    • Replicate_Enable_Ddl: true

    • Skip_Tso

    • Skip_Until_Tso

  • Other parameters

    • Last_Error: the most recent error that is reported for the primary/secondary replication link.

    • Seconds_Behind_Master: the current primary/secondary replication latency of the primary/secondary replication link.