- マスタのバイナリログを控える
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)
mysql> show master status;
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| master-bin.000001 | 581 | | |
+-------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
- master側のMySQL停止
- データファイルのコピー コピーするのは
- data/<database名>のファイル
- ibdata1のファイル(innodbを使っている時のデータファイル)
- slave側でmasterを認識させる
master側でレプリケーション用のユーザを作成する
# localhost はスレーブのIP
grant replication slave on *.* to 'repl'@localhost indentified by 'repl00'
slave側で実行する
change master to
master_host = 'localhost',
master_user = 'repl',
master_password = 'repl00',
master_log_file = 'master-bin.000001',
master_log_pos = 581;
# slaveを起動
start slave;