SHOW SLAVE HOSTS

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

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

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.