MySQL主备复制搭建(使用mysqld_multi)(二)

2015-07-16 12:08:50 · 作者: · 浏览: 1
ting for master to send event
? ? ? ? ? ? ? ? ? Master_Host: localhost
? ? ? ? ? ? ? ? ? Master_User: replication
? ? ? ? ? ? ? ? ? Master_Port: 3307
? ? ? ? ? ? ? ? Connect_Retry: 60
? ? ? ? ? ? ? Master_Log_File: mysql-bin.000001
? ? ? ? ? Read_Master_Log_Pos: 622
? ? ? ? ? ? ? Relay_Log_File: mysql-relay-bin.000002
? ? ? ? ? ? ? ? Relay_Log_Pos: 767
? ? ? ? Relay_Master_Log_File: mysql-bin.000001
? ? ? ? ? ? Slave_IO_Running: Yes
? ? ? ? ? ? Slave_SQL_Running: Yes
? ? ? ? ? ? ? Replicate_Do_DB:
? ? ? ? ? Replicate_Ignore_DB:
? ? ? ? ? Replicate_Do_Table:
? ? ? Replicate_Ignore_Table:
? ? ? Replicate_Wild_Do_Table:
? Replicate_Wild_Ignore_Table:
? ? ? ? ? ? ? ? ? Last_Errno: 0
? ? ? ? ? ? ? ? ? Last_Error:
? ? ? ? ? ? ? ? Skip_Counter: 0
? ? ? ? ? Exec_Master_Log_Pos: 622
? ? ? ? ? ? ? Relay_Log_Space: 922
? ? ? ? ? ? ? Until_Condition: None
? ? ? ? ? ? ? Until_Log_File:
? ? ? ? ? ? ? ? Until_Log_Pos: 0
? ? ? ? ? Master_SSL_Allowed: No
? ? ? ? ? Master_SSL_CA_File:
? ? ? ? ? Master_SSL_CA_Path:
? ? ? ? ? ? ? Master_SSL_Cert:
? ? ? ? ? ? Master_SSL_Cipher:
? ? ? ? ? ? ? Master_SSL_Key:
? ? ? ? Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
? ? ? ? ? ? ? ? Last_IO_Errno: 0
? ? ? ? ? ? ? ? Last_IO_Error:
? ? ? ? ? ? ? Last_SQL_Errno: 0
? ? ? ? ? ? ? Last_SQL_Error:
1 row in set (0.00 sec)


--------------------------------------------------------------------------------
?当看到Slave_IO_Running: Yes 和 Slave_SQL_Running: Yes证明io通信线程和sql回放线程都已经启动。至此,主备复制结构配置完成



5.进行正常主从测试:
在mysql3308数据库停止复制


--------------------------------------------------------------------------------
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)


mysql> show slave status \G;? ? ? ? ?
*************************** 1. row ***************************
? ? ? ? ? ? ? Slave_IO_State:
? ? ? ? ? ? ? ? ? Master_Host: localhost
? ? ? ? ? ? ? ? ? Master_User: replication
? ? ? ? ? ? ? ? ? Master_Port: 3307
? ? ? ? ? ? ? ? Connect_Retry: 60
? ? ? ? ? ? ? Master_Log_File: mysql-bin.000005
? ? ? ? ? Read_Master_Log_Pos: 408
? ? ? ? ? ? ? Relay_Log_File: mysql-relay-bin.000012
? ? ? ? ? ? ? ? Relay_Log_Pos: 553
? ? ? ? Relay_Master_Log_File: mysql-bin.000005


--------------------------------------------------------------------------------



在mysql3309数据库停止复制


--------------------------------------------------------------------------------
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)


mysql> show slave status \G;
*************************** 1. row ***************************
? ? ? ? ? ? ? Slave_IO_State:
? ? ? ? ? ? ? ? ? Master_Host: localhost
? ? ? ? ? ? ? ? ? Master_User: replication
? ? ? ? ? ? ? ? ? Master_Port: 3307
? ? ? ? ? ? ? ? Connect_Retry: 60
? ? ? ? ? ? ? Master_Log_File: mysql-bin.000006
? ? ? ? ? Read_Master_Log_Pos: 316


--------------------------------------------------------------------------------



查看mysql日志情况:


--------------------------------------------------------------------------------
150510? 1:33:39 [Note] Error reading relay log event: slave SQL thread was killed
150510? 1:33:39 [Note] Slave I/O thread killed while reading event
150510? 1:33:39 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000005', position 408



150510? 1:35:41 [Note] Error reading relay log event: slave SQL thread was killed
150510? 1:35:41 [Note] Slave I/O thread killed while reading event
150510? 1:35:41 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000006', position 316


--------------------------------------------------------------------------------



? ? 在这期间,主库mysql3307进行了flush logs操作,重新生成了mysql-bin日志,并对表进行添加,删除操作。然后启动从库的复制,进行查看。


-------------