Replication Implementation
1475
For slaves that were started with the
--report-host
[1460]
option and are connected to the master,
the
SHOW SLAVE HOSTS
statement on the master shows basic information about the slaves. The
output includes the ID of the slave server, the value of the
--report-host
[1460]
option, the
connecting port, and master ID:
mysql>
SHOW SLAVE HOSTS;
+-----------+--------+------+-------------------+-----------+
| Server_id | Host | Port | Rpl_recovery_rank | Master_id |
+-----------+--------+------+-------------------+-----------+
| 10 | slave1 | 3306 | 0 | 1 |
+-----------+--------+------+-------------------+-----------+
1 row in set (0.00 sec)
16.1.3.2. Pausing Replication on the Slave
You can stop and start the replication of statements on the slave using the
STOP SLAVE
and
START
SLAVE
statements.
To stop processing of the binary log from the master, use
STOP SLAVE
:
mysql>
STOP SLAVE;
When replication is stopped, the slave I/O thread stops reading events from the master binary log and
writing them to the relay log, and the SQL thread stops reading events from the relay log and executing
them. You can pause the I/O or SQL thread individually by specifying the thread type:
mysql>
STOP SLAVE IO_THREAD;
mysql>
STOP SLAVE SQL_THREAD;
To start execution again, use the
START SLAVE
statement:
mysql>
START SLAVE;
To start a particular thread, specify the thread type:
mysql>
START SLAVE IO_THREAD;
mysql>
START SLAVE SQL_THREAD;
For a slave that performs updates only by processing events from the master, stopping only the SQL
thread can be useful if you want to perform a backup or other task. The I/O thread will continue to read
events from the master but they are not executed. This makes it easier for the slave to catch up when
you restart the SQL thread.
Stopping only the I/O thread enables the events in the relay log to be executed by the SQL thread up
to the point where the relay log ends. This can be useful when you want to pause execution to catch
up with events already received from the master, when you want to perform administration on the slave
but also ensure that it has processed all updates to a specific point. This method can also be used
to pause event receipt on the slave while you conduct administration on the master. Stopping the I/O
thread but permitting the SQL thread to run helps ensure that there is not a massive backlog of events
to be executed when replication is started again.
16.2. Replication Implementation
Replication is based on the master server keeping track of all changes to its databases (updates,
deletes, and so on) in its binary log. The binary log serves as a written record of all events that modify
database structure or content (data) from the moment the server was started. Typically,
SELECT
statements are not recorded because they modify neither database structure nor content.
Each slave that connects to the master requests a copy of the binary log. That is, it pulls the data from
the master, rather than the master pushing the data to the slave. The slave also executes the events
from the binary log that it receives. This has the effect of repeating the original changes just as they
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...