---title:mha相关部署及配置---[toc]## 基础信息192.168.200.78192.168.200.79192.168.200.80
## 部署软件及创建用户
```GRANT REPLICATION SLAVE ON *.* TO repluser@192.168.200.79 IDENTIFIED BY 'replpass';
GRANT REPLICATION SLAVE ON *.* TO repluser@192.168.200.80 IDENTIFIED BY 'replpass';flush privileges;```
或者
```create user repluser@'192.168.200.%' IDENTIFIED BY 'replpass';```## 导入 数据(如果非新库)```mysqldump -E -R --single-transaction -A >alldb201712041030.sql[root@mysqltest01-200-78 tmp]# scp alldb201712041030.sql root@192.168.200.79:/tmp/root@192.168.200.79's password: alldb201712041030.sql 100% 760KB 61.8MB/s 00:00 [root@mysqltest01-200-78 tmp]# scp alldb201712041030.sql root@192.168.200.80:/tmp/root@192.168.200.80's password: alldb201712041030.sql [root@mysqltest01-200-79 tmp]# mysql reset master
root@mysqltest01-200-80 21:32: [(none)]> reset master
CHANGE MASTER TO MASTER_HOST='192.168.200.78',
MASTER_USER='repluser',
MASTER_PASSWORD='replpass',
MASTER_AUTO_POSITION=1;
Start slave;
```
## 配置MHA
grant all privileges on *.* to 'mhamon'@'%' identified by 'mhamonpass';
--orig_master_is_new_slave --running_updates_limit=10000
导入之前记得resetmaster
create user repl@'192.168.1.%' IDENTIFIED BY '1tcpnajvTecDin3ahbs';
GRANT REPLICATION SLAVE ON *.* TO repl@'192.168.1.%';
CHANGE MASTER TO MASTER_HOST='192.168.1.14',
MASTER_USER='repl',
MASTER_PASSWORD='1tcpnajvTecDin3ahbs',
MASTER_AUTO_POSITION=1;
网友评论