SHOW REPLICATION STATUS

Shows the list of all connections between the replication master and slave databases.

Syntax

SHOW REPLICATION STATUS

Remarks

  • The URI identifies the database as <host>:<port>/<dbName>.
  • Log position is the position in the transactional log formatted as <LogFileId>:<ByteOffsetInLogFile>.
  • Each database in slave-replication mode has two background threads (SlaveNetwork and SlaveReplay). The state and position of both slave threads are displayed per-database. The SlaveNetwork thread downloads the necessary snapshot files and transaction logs from the master database and the SlaveReplay thread reads transactions from these files and commits them to memory.
  • The difference between MasterLogPos and SlaveReplayPos is the current replication lag. When the slave synchronizes fully with the master, all three log positions are identical.
  • This command can be run on any MemSQL node (see Node Requirements for MemSQL Commands).

Output

Column Explanation
Role The replication role of the local database copy. Possible values are async slave, sync slave, and master.
Database The name of the database being replicated. The database name is the same on the primary and secondary clusters, except for the sharding database which is called sharding_[hash] on the secondary cluster.
MasterURI The URI for the master database instance. The format is host:port/database_name.
MasterPosition The current log file position of data that of the primary cluster. NetworkPosition uses the format [ordinal]:[byte offset into log file].
SlaveURI The URI for the slave database instance. The format is host:port/database_name.
Connected The current state of the connection between master and slave instances of the database. Possible values are yes and no.
NetworkPosition The current log file position of data that has been downloaded to the secondary cluster. MemSQL names log files in the format [database name]_log_[ordinal]. NetworkPosition uses the format [ordinal]:[byte offset into log file].
SlaveState The state of the slave instance of the database. Possible values are replicating and replication paused.
ReplayPosition The current log file position of data that has been loaded into memory on the secondary cluster. NetworkPosition uses the format [ordinal]:[byte offset into log file].
MasterCommits The number of transactions committed on the master database instance.
SlaveCommits The number of transactions committed on the slave database instance.

Example

memsql> SHOW REPLICATION STATUS;
+-------------+-----------------------------+--------------+-------------------------------+-----------+-----------------+------------------+----------------+
| Role        | MasterURI                   | MasterLogPos | SlaveURI                      | Connected | SlaveNetworkPos | SlaveReplayState | SlaveReplayPos |
+-------------+-----------------------------+--------------+-------------------------------+-----------+-----------------+------------------+----------------+
| async slave | users-instance-A:3306/users | 0:8870       | localhost:3306/users          | yes       | 0:8870          | replicating      | 0:8870         |
+-------------+-----------------------------+--------------+-------------------------------+-----------+-----------------+------------------+----------------+
Was this article useful?