Outdated Version

You are viewing an older version of this section. View current production version.

SHOW REPLICATION STATUS

Shows the list of all connections between the replication master and secondary 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 replicating mode has two background threads (SecondaryNetwork and SecondaryReplay). The state and position of both threadss are displayed per-database. The SecondaryNetwork thread downloads the necessary snapshot files and transaction logs from the primary database and the SecondaryReplay thread reads transactions from these files and commits them to memory.
  • This command can be run on any MemSQL node (see Node Requirements for MemSQL Commands).
  • If a sync replica is out of sync it will not appear in the output.
  • This command does not display DR clusters and the primary databases that do not have replicas.
  • While replication, if replay gets too far behind on a secondary database, the primary database throttles (slows down) writes on the replica. It is not required for the replay to acknowledge a transaction.

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 primary database instance. The format is host:port/database_name.
Master_State The state of the primary database instance. Commonly, the master state is online but differs during transition periods/errors. See Database States for details.
Master_CommitLSN Position in the log before which all pages have been committed. All content is committed in the pages that are in the log before this log sequence number (LSN).
Master_HardenedLSN Position in the log before which all pages have been written to the disk.
Master_ReplayLSN Position in the log before which all pages have been replayed into memory.
Master_TailLSN Position in the log before which all pages have been reserved for transactions. The next transaction to reserve space from the log will start writing at this LSN.
MasterCommits The number of transactions committed on the primary database instance.
Connected The current state of the connection between master and replica instances of the database. Possible values are yes and no.
Throttling Specifies whether the primary database has slowed down writes on a slave. Possible values are yes and no.
SlaveURI The URI for the secondary database instance. The format is host:port/database_name.
SlaveState The state of the secondary database instance. Possible values are replicating and replication paused.
Slave_CommitLSN Position in the log before which all pages have been committed. It is replicated from the master, and thus is expected to be behind Master_CommitLSN.
Slave_HardenedLSN Position in the log before which all pages have been written to the disk.
Slave_ReplayLSN Position in the log before which all pages have been replayed into memory. It is always less than or equal to CommitLSN (in an active workload, it is expected to lag behind CommitLSN by few LSN).
Slave_TailLSN All pages that have been received from the master is below this LSN.
SlaveCommits The number of transactions committed on the secondary database instance.
Info

This MemSQL feature is only available in MemSQL Enterprise Edition. MemSQL Enterprise Edition includes 24x7 support and several enterprise-only features for critical deployments. For more information about MemSQL Developer and MemSQL Enterprise, see the MemSQL Editions page.

Example

memsql> SHOW REPLICATION STATUS;
****
+--------+----------+------------+--------------+------------------+--------------------+------------------+----------------+----------------+-----------+------------+------------------------+-------------+-----------------+-------------------+-----------------+---------------+---------------+
| Role   | Database | Master_URI | Master_State | Master_CommitLSN | Master_HardenedLSN | Master_ReplayLSN | Master_TailLSN | Master_Commits | Connected | Throttling | Slave_URI              | Slave_State | Slave_CommitLSN | Slave_HardenedLSN | Slave_ReplayLSN | Slave_TailLSN | Slave_Commits |
+--------+----------+------------+--------------+------------------+--------------------+------------------+----------------+----------------+-----------+------------+------------------------+-------------+-----------------+-------------------+-----------------+---------------+---------------+
| master | cluster  | NULL       | online       | 0:239            | 0:239              | 0:233            | 0:239          |             32 | yes       | no         | 127.0.0.1:3307/cluster | replicating | 0:238           | 0:239             | 0:238           | 0:239         |            30 |
| master | trades   | NULL       | online       | 0:4294967341     | 0:4294967341       | 0:4294967339     | 0:4294967341   |             39 | yes       | no         | 127.0.0.1:3307/trades  | replicating | 0:4294967340    | 0:4294967341      | 0:4294967340    | 0:4294967341  |            38 |
+--------+----------+------------+--------------+------------------+--------------------+------------------+----------------+----------------+-----------+------------+------------------------+-------------+-----------------+-------------------+-----------------+---------------+---------------+