Oracle 5.0 Reference Manual page 322

Table of Contents

Advertisement

Log warnings and errors by appending them to the named file. The default is to do no logging. This
option was added in MySQL 5.0.42.
--master-data[=value]
Use this option to dump a master replication server to produce a dump file that can be used to set
up another server as a slave of the master. It causes the dump output to include a
statement that indicates the binary log coordinates (file name and position) of the dumped server.
TO
These are the master server coordinates from which the slave should start replicating after you load
the dump file into the slave.
If the option value is 2, the
thus is informative only; it has no effect when the dump file is reloaded. If the option value is 1, the
statement is not written as a comment and takes effect when the dump file is reloaded. If no option
value is specified, the default value is 1.
This option requires the
The
--master-data
on
--lock-all-tables
which case, a global read lock is acquired only for a short time at the beginning of the dump (see the
description for
--single-transaction
exact moment of the dump.
It is also possible to set up a slave by dumping an existing slave of the master. To do this, use the
following procedure on the existing slave:
1. Stop the slave's SQL thread and get its current status:
mysql>
STOP SLAVE SQL_THREAD;
mysql>
SHOW SLAVE STATUS;
2. From the output of the
the master server from which the new slave should start replicating are the values of the
Relay_Master_Log_File
and file_pos.
file_name
3. Dump the slave server:
shell>
mysqldump --master-data=2 --all-databases > dumpfile
Using
--master-data=2
Otherwise,
mysqldump
case you must handle any locking issues in another manner, using one or more of
[298],
locks
--lock-tables
[304], as required by your application and environment.
transaction
4. Restart the slave:
mysql>
START SLAVE;
5. On the new slave, load the dump file:
shell>
mysql < dumpfile
6. On the new slave, set the replication coordinates to those of the master server obtained earlier:
mysql>
CHANGE MASTER TO
->
MASTER_LOG_FILE = 'file_name', MASTER_LOG_POS = file_pos;
The
CHANGE MASTER TO
to point the slave to the correct master server host. Add any such parameters as necessary.
— A Database Backup Program
mysqldump
[302]
CHANGE MASTER TO
[577]
privilege and the binary log must be enabled.
RELOAD
[302]
option automatically turns off
[301], unless
--single-transaction
[304]). In all cases, any action on logs happens at the
SHOW SLAVE STATUS
and
Exec_Master_Log_Pos
works only if binary logging has been enabled on the slave.
fails with the error
[301],
--lock-all-tables
statement might also need other parameters, such as
302
statement is written as an SQL comment, and
--lock-tables
[304]
statement, the binary log coordinates of
fields. Denote those values as
Binlogging on server not
[301], or
CHANGE MASTER
[301]. It also turns
also is specified, in
active. In this
--add-
--single-
MASTER_HOST

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents