2台机器都装上mysql:192.168.8.201(master)和192.168.5.71(slave),主要配置mysql.cnf
master机器vi my.cnf,添加下面的
log-bin
server-id = 1
sql-bin-update-same
binlog-do-db=wiki //备份的数据库名,可以添加多个
slave机器
log-bin
server-id = 2
sql-bin-update-same #mysql5 要把这一条注释掉,否则mysql起不来
master-host=192.168.8.201
master-user=backup
master-password=123456
master-port=3306
master-connect-retry=10
replicate-do-db=wiki
log-slave-updates
启动2个mysql,master机器上
GRANT all ON *.* TO IDENTIFIED BY "123456";
手动load数据
mysql>load data from master;
清除日志
mysql>PURGE MASTER LOGS BEFORE DATE_SUB(NOW(),INTERVAL 3 DAY)
阅读(1664) | 评论(0) | 转发(0) |