Mysql服务器的主辅数据同步(二)

2014-11-24 14:12:04 · 作者: · 浏览: 1
.168.18.127:/tmp/
The authenticity of host '192.168.18.127 (192.168.18.127)' can't be established.
RSA key fingerprint is f7:a5:9e:2f:86:57:a5:17:f4:ad:2b:3a:a8:55:0f:76.
Are you sure you want to continue connecting (yes/no) yes
Warning: Permanently added '192.168.18.127' (RSA) to the list of known hosts.
root@192.168.18.127's password:
mysql.sql 100% 1039MB 20.8MB/s 00:50
[root@localhost mysql]#
Slave2:
[root@localhost mysql]# mysql < /tmp/mysql.sql
Master:
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 |
+---------------+----------+--------------+------------------+
| binlog.000003 | 365 | | |
+---------------+----------+--------------+------------------+
1 row in set (0.00 sec)
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)
Slave2:
mysql> change master to master_host='192.168.18.107', master_port=3306, master_user='ab', master_password='123', master_log_file='binlog.000003',master_log_pos=365;
Query OK, 0 rows affected (0.05 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
测试:
mysql> show slave status \G
在出结果的数据中,以下语句为yes成功
Slave_IO_Running: Yes
Slave_SQL_Running: Yes