MySQueaL Resources

resources for mysql admins and developers who are squealing for help

More Resources

Main Doc Pages
Comments
MySQL columns: everywhere I look are tables and columns; life is filled with databases of information to be ordered and grouped. (Ca'Grande, Milan, Italy)

SHOW SLAVE HOSTS Statement

This MySQL statement displays a list of slave servers for the master server.

hits past month: 8 ;  last updated: may 4, 2009 - 2:34am ;  parent: MySQL Replication

Syntax

SHOW SLAVE HOSTS

Explanation

This MySQL statement displays a list of replication slave servers for the master server running replication. Slaves must be started with the --report-host=slave option in order to be visible.

Examples

SHOW SLAVE HOSTS;

+------------+-----------+------+-----------+
| Server_id  | Host      | Port | Master_id |
+------------+-----------+------+-----------+
|          2 | slave2    | 3306 |         1 |
|          3 | slave3    | 3306 |         1 |
+------------+-----------+------+-----------+

In the results there are four values for each slave:

  • Server_id
  • The server identification number for the replication slave server, which is set by the --server-id option (preferably in the slave's options file).

  • Host
  • The host name of the replication slave server, which is set by the --report-host option on the slave.

  • Port
  • The port on which the replication slave is listening for replication. This defaults to 3306, but can be set with the MySQL statement, CHANGE MASTER TO.

  • Master_id
  • The server identification number of the master running replication. It's set on the master with --server-id and conversely on the slave with the MySQL statement, CHANGE MASTER TO.

Return to MySQL Replication page of our MySQL Documentation