Master Configuration:
The Code is as follows: |
|
Log-bin = mysql-bin Server-id = 1 Binlog-do-db = powerdns # database to be synchronized |
Add an slave account to the Master:
The Code is as follows: |
|
Mysql> GRANT replication slave ON *. * TO 'slave '@ '192. 168.1.2 'identified BY 'passwd '; Mysql> FLUSH privileges; |
Restart Master MySQL, view Master status information, and remember the File name and POS location.
The Code is as follows: |
|
Mysql> show master status; + ------------------ + ---------- + -------------- + ------------------ + | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | + ------------------ + ---------- + -------------- + ------------------ + | Mysql-bin.000002 | 309 | powerdns | mysql | + ------------------ + ---------- + -------------- + ------------------ + 1 row in set (0.00 sec) |
Slave Configuration:
The Code is as follows: |
|
Server-id = 2 |
Start synchronization:
The Code is as follows: |
|
Mysql> CHANGE master TO master_host = '192. 168.1.1 ', master_user = 'slave', master_password = 'passwd ', Master_log_file = 'mysql-bin.000002 ', master_log_pos = 309; Mysql> START slave; |
View the Slave synchronization status:
The Code is as follows: |
|
Mysql> SHOW slave STATUSG; Slave_IO_Running: Yes Slave_ SQL _Running: Yes |