MySQL AB复制(十)

2014-11-24 17:00:06 · 作者: · 浏览: 11
649D647DB04E7CCCACAB4368B6 | 192.168.1.% |
+-------+-------------------------------------------+-------------+
1 row in set (0.00 sec)mysql> show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000001 | 1046 |
| mysql-bin.000002 | 606 |
| mysql-bin.000003 | 126 |
| mysql-bin.000004 | 335 |
+------------------+-----------+
4 rows in set (0.00 sec)
第十步,serv09通过change master to修改slave配置,然后启动slave,查看slave状态,查看数据,发现已经从serv08更新过来
mysql> change master to
-> master_host='192.168.1.18',
-> master_user='larry',
-> master_password='larry',
-> master_port=3306,
-> master_log_file='mysql-bin.000003',
-> master_log_pos=126;
Query OK, 0 rows affected (0.03 sec)mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.1.18
Master_User: larry
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 126
Relay_Log_File: serv09-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: No
Slave_SQL_Running: No
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: 126
Relay_Log_Space: 107
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
1 row in set (0.00 sec)ERROR:
No query specifiedmysql> start slave;
Query OK, 0 rows affected (0.01 sec)mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.18
Master_User: larry
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000004
Read_Master_Log_Pos: 335
Relay_Log_File: serv09-relay-bin.000003
Relay_Log_Pos: 481
Relay_Master_Log_File: mysql-bin.000004
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: 335
Relay_Log_Space: 784
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:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 2
1 row in set (0.00 sec)ERROR:
No query specifiedmysql> select * from larrydb.t2;
+----+---------+
| id | name |
+----+---------+
| 1 | larry01 |
| 3 | larry02 |
| 4 | larry03 |
| 6 | larry04 |
| 7 | larry05 |
| 9 | larry07 |
| 11 | larry08 |
+----+---------+
7 rows in set (0.00 sec)
第十一步,serv01插入数据,可以看到se