slave_status

NAME

slave_status: Provide with slave status info

TYPE

View

DESCRIPTION

slave_status displays minimal information about this server's slave status. Its information is generally a subset of SHOW SLAVE STATUS.

A problem with MySQL's SHOW SLAVE STATUS is that it cannot be read nor used on server side; one cannot open cursor on this statement. The slave_status view attempts to provide with as much info (though minimal) about the status of replication. In particular, the Seconds_Behind_Master value is provided by this view.

NOTE, this view is experimental.

STRUCTURE

mysql> DESC common_schema.slave_status;
+-----------------------+---------------+------+-----+---------+-------+
| Field                 | Type          | Null | Key | Default | Extra |
+-----------------------+---------------+------+-----+---------+-------+
| Slave_Connected_time  | decimal(32,0) | YES  |     | NULL    |       |
| Slave_IO_Running      | int(1)        | NO   |     | 0       |       |
| Slave_SQL_Running     | int(1)        | NO   |     | 0       |       |
| Slave_Running         | int(1)        | NO   |     | 0       |       |
| Seconds_Behind_Master | decimal(32,0) | YES  |     | NULL    |       |
+-----------------------+---------------+------+-----+---------+-------+

SYNOPSIS

Columns of this view:

  • Slave_Connected_time: Number of seconds this slave has been connected to its master, or NULL if not connected.
  • Slave_IO_Running: 1 if the slave I/O thread is currently running, 0 otherwise.
  • Slave_SQL_Running: 1 if the slave SQL thread is currently running, 0 otherwise.
  • Slave_Running: 1 if both IO and SQL threads are running, 0 otherwise.
  • Seconds_Behind_Master: number of seconds this server is lagging behind its master, or NULL if not replicating.

EXAMPLES

Get slave status on a replicating slave:

mysql> SELECT * FROM slave_status \G
*************************** 1. row ***************************
 Slave_Connected_time: 82077
     Slave_IO_Running: 1
    Slave_SQL_Running: 1
        Slave_Running: 1
Seconds_Behind_Master: 5
In the above the slave is lagging 5 seconds behind its master. Otherwise, replication is up and running.

ENVIRONMENT

MySQL 5.1 or newer.

SEE ALSO

processlist_repl, processlist_top

AUTHOR

Shlomi Noach
 
common_schema documentation