te: Waiting for master to send event
Master_Host: 172.16.1.3
Master_User: zhaoyun
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysqld-bin.000001
Read_Master_Log_Pos: 315
Relay_Log_File: mysqld-relay-bin.000002
Relay_Log_Pos: 453
Relay_Master_Log_File: mysqld-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: 315
Relay_Log_Space: 453
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
1 row in set (0.00 sec)
ERROR:
No query specified
mysql>
#这个是主服务的binlog文件的状态,如果出现IO是NO的话,需检查这俩个文件的状态。
Master_Log_File: mysqld-bin.000001
Read_Master_Log_Pos: 315
#这俩条是slave的IO进程,和SQL进程的状态,AB复制的服务只有都为yes时才可用。
Slave_IO_Running: YES
Slave_SQL_Running: YES
#IO进程为NO可以将BACKUP的数据文件删除,重启服务重新同步就行了。
5、到现在配置基本完成
三、创建一个表进行测试,是否同步成功。
1、在master上创建。
mysql> create database master ;
Query OK, 1 row affected (0.00 sec)
mysql> use master
Database changed
mysql> create table master(id int,name char(5));
Query OK, 0 rows affected (0.04 se
2、在backup查看
[root@BACKUP ~]# mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show database ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> show databases ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| master |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use master
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables ;
+------------------+
| Tables_in_master |
+------------------+
| master |
+------------------+
1 row in set (0.00 sec)
mysql>
可以看到数据已经同步过来了。到此实验成功。
故障排除:
IO 等于NO : 需要检查节点和binlog文件名是否和在master看到的一致,如果不一致可以手动改写
命令
先停止slave服务
mysql>slave stop;
mysql>change master to master_log_file="在master看到的binlog文件名";
mysql>change master to master_log_pos=100; 这个数字是在master看到的。
mysql>slave start ;
mysql> show master status ;
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| mysqld-bin.000001 | 507 | | |
+-------------------+----------+--------------+--- |