1、自動安裝部署mysql,若已經安裝了mysql得先判斷版本是否比主庫低(存在向下兼容問題)
2、獲取主庫的備份文件及binlog信息(binary logfile,binary position)
3、修改從服務器的配置文件信息
server-id不能重復
replicate-wild-do-table=xxx.%
replicate-wild-ignore-table=mysql.%
4、導入主庫的備份文件
5、在主庫中添加從庫的授權信息
GRANT REPLICATION SLAVE ON *.* TO ‘backup’@’10.144.32.119′ IDENTIFIED BY PASSWORD ‘*CC9860AEF70E1F48CCA5505EC1DC943085A4AEBB’;
6、設置連接主庫的信息
CHANGE MASTER TO
MASTER_HOST=’10.163.167.7′,
MASTER_USER=’backup’,
MASTER_PASSWORD=’backup’,
MASTER_PORT=3306,
MASTER_LOG_FILE=’mysql-bin.000010′,
MASTER_LOG_POS=399387901,
MASTER_CONNECT_RETRY=10;
7、開啟復制
start slave;