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.
SHOW REPLICATION STATUS
Notes
- 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
andSecondaryReplay
). The state and position of both threadss are displayed per-database. TheSecondaryNetwork
thread downloads the necessary snapshot files and transaction logs from the primary database and theSecondaryReplay
thread reads transactions from these files and commits them to memory. - The difference between
MasterLogPos
andSecondaryReplayPos
is the current replication lag. When the replica 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 primary 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 secondary database instance. The format is host:port/database_name . |
Connected | The current state of the connection between master and replica 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 replica 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 primary database instance. |
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 Community and MemSQL Enterprise, see the MemSQL Editions page.
Example
memsql> SHOW REPLICATION STATUS;
+-------------+-----------------------------+--------------+-------------------------------+-----------+-----------------+------------------+----------------+
| Role | MasterURI | MasterLogPos | SlaveURI | Connected | SecondaryNetworkPos | SecondaryReplayState | SecondaryReplayPos |
+-------------+-----------------------------+--------------+-------------------------------+-----------+-----------------+------------------+----------------+
| async slave | users-instance-A:3306/users | 0:8870 | localhost:3306/users | yes | 0:8870 | replicating | 0:8870 |
+-------------+-----------------------------+--------------+-------------------------------+-----------+-----------------+------------------+----------------+