配置后,MySQL复制未运行

时间:2018-09-29 04:14:54

标签: mysql database-replication

我正在用2个Centos 6.9 64位虚拟机练习mysql复制。设置过程很好,但是当我将数据插入主服务器后,从服务器中发生任何事情。

主设置

mysql.cnf

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0


log-bin=mysql-bin
binlog-do-db=dbtest
server-id=1
innodb_flush_log_at_trx_commit=1
sync_binlog=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

mysql>显示主服务器状态

mysql-bin.000002 |    13069 | dbtest

mysql>显示进程列表

 145 | root | 192.168.1.11:45148 | NULL       | Binlog Dump |  810 | Has sent all binlog to slave; waiting for binlog to be updated | NULL   

从设置

my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0

#Replication
server-id=2
replicate-do-db=dbtest
master-host=192.168.1.10
master-user=root
master-password=master_password

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

mysql>显示从属状态

Slave_IO_State : Waiting for master to send event
Master_Host : 192.168.1.10
Master_User : root
Master_Port : 3306
Connect_Retry : 60
Master_Log_File : mysql-bin.000002
Read_Master_Log_Pos : 12954 
Relay_Log_File : mysqld-relay-bin.000017 
Relay_Log_Pos : 251
Relay_Master_Log_File :  mysql-bin.000002 
Slave_IO_Running : Yes
Slave_SQL_Running : Yes
Replicate_Do_DB : dbtest
Last_Errno : 0
Skip_Counter : 0
Exec_Master_Log_Pos : 12954
Relay_Log_Space : 552
Until_Condition : None
Until_Log_Pos : 0
Master_SSL_Allowed : No
Seconds_Behind_Master : 0
Master_SSL_Verify_Server_Cert : No
Last_IO_Errno : 0
Last_SQL_Errno : 0

mysql>显示进程列表

 5 | system user |                 | NULL       | Connect | 1251 | Waiting for master to send event | NULL 

我关注this guide。感谢您的帮助。

0 个答案:

没有答案