Mysql复制(Replication)的实现(二)
*************************
05
Slave_IO_State: Waiting for master to send event
06 www.2cto.com
Master_Host: server1
07
Master_User: repl
08
Master_Port: 3306
09
Connect_Retry: 60
10
Master_Log_File: mysql-bin.000001
11
Read_Master_Log_Pos: 164
12
Relay_Log_File: mysql-relay-bin.000001
13
Relay_Log_Pos: 164
14
Relay_Master_Log_File: mysql-bin.000001
15
Slave_IO_Running: Yes
16
Slave_SQL_Running: Yes
17
...omitted...
18
Seconds_Behind_Master: 0
注意,slave的I/O和SQL线程都已经开始运行,而且Seconds_Behind_Master不再是NULL。日志的位置增加了,意味着一些事件被获取并执行了。如果你在master上进行修改,你可以在slave上看到各种日志文件的位置的变化,同样,你也可以看到
数据库中数据的变化。
你可查看master和slave上线程的状态。在master上,你可以看到slave的I/O线程创建的连接:
01
mysql> show processlist \G
02
*************************** 1. row ***************************
03
Id: 1
04
User: root
05
Host: localhost:2096
06
db: test www.2cto.com
07
Command: Query
08
Time: 0
09
State: NULL
10
Info: show processlist
11
*************************** 2. row ***************************
12
Id: 2
13
User: repl
14
Host: localhost:2144
15
db: NULL
16
Command: Binlog Dump
17
Time: 1838 www.2cto.com
18
State: Has sent all binlog to slave; waiting for binlog to be updated
19
Info: NULL
20
2 rows in set (0.00 sec)
基本到这里就完成,至于后期的加强操作,我会在另行添加。
测试过程要主要的问题:
1.请先配置好Mysql
2.开通复制前请将Mysql的库和表的框架复制过去。(在测试一下能不能连表都复制过去!)
作者 Tingel