1,查看master的状态
SHOW MASTER STATUS;
Position 不应为0
2,查看slave的状态
show slave status;
Slave_IO_Running | Slave_SQL_Running 这两个字段 应为 YES|YES.
show processlist;
会有两条记录与同步有关 state为 Has read all relay log; waiting for the slave I/O thread to update it
和s Waiting for master to send event .
3,错误日志
MySQL安装目录dataHostname.err
主服务器上的相关命令:
show master status
show slave hosts
show {master|binary} logs
show binlog events
purge {master|binary} logs to ’log_name’
purge {master|binary} logs before ’date’
reset master(老版本flush master)
set sql_log_bin={0|1}
-----------------------------------------------------------------------------------
从服务器上的相关命令:
slave start
slave stop
SLAVE STOP IO_THREAD //此线程把master段的日志写到本地
SLAVE start IO_THREAD
SLAVE STOP SQL_THREAD //此线程把写到本地的日志应用于数据库
SLAVE start SQL_THREAD
reset slave
SET GLOBAL SQL_SLAVE_SKIP_COUNTER
load data from master
show slave status(SUPER,REPLICATION CLIENT)
CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=,MASTER_USER=, MASTER_PASSWORD= //动态改变master信息
PURGE MASTER [before ’date’] 删除master端已同步过的日志