rm -rf /etc/yum.repos.d/c*
for i in 100 101 102 103
do
ssh-copy-id 192.168.10.$iecho"StrictHostKeyChecking no">>/etc/ssh/ssh_config
donefor i in 100 101 102 103
doecho"192.168.10.$i">> /etc/hosts
done
echo"validate-password=OFF">> /etc/my.cnf
systemctl restart mysqld && systemctl enable mysqld
grep'password' /var/log/mysqld.log
mysql -u root -p
set password for root@localhost = password('123456');
flush privileges;exit
systemctl restart mysqld
rpm -ivh mha4mysql-node-0.57-0.el7.noarch.rpm
master操作:
rpm -ivh mha4mysql-manager-0.57-0.el7.noarch.rpm
cat>> /etc/my.cnf<<eof
server-id=1
log-bin=mysql-bin-master
binlog-do-db=test_db
eof
systemctl restart mysqld
mysql -uroot -p123456
create database test_db;
use test_db;
create table employee(ID int(12)not null primary key ,NAME varchar(8)not null,AGE int(3)not null);
desc employee;
create user mha identified by '123456';
create user slave identified by '123456';
grant replication slave on *.* to 'slave'@'192.168.10.%' identified by '123456';
grant all privileges on *.* to 'mha'@'192.168.10.%' identified by '123456';
flush privileges;
show master status\G
backup操作:
cat>> /etc/my.cnf<<eof
server-id=2
log-bin=mysql-bin-slave1
binlog-do-db=test_db
log-slave-updates=1
eof
systemctl restart mysqld
mysql -uroot -p123456
grant replicat