架构
主:172.17.100.106
从:172.17.100.107
MHA:172.17.100.120
VIP:172.17.100.119
MySQL搭建
MySQL版本:5.7.22
搭建脚本:MySQL5.7.22搭建脚本
配置多机互信
# 每个节点都执行
ssh-keygen -t rsa # 一路回车
# 将公钥添加到认证文件中
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
# 并设置authorized_keys的访问权限
chmod 600 ~/.ssh/authorized_keys
# 只要在一个节点执行即可
# 这里在主库 172.17.100.106上执行
ssh 172.17.100.107 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
ssh 172.17.100.108 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
ssh 172.17.100.120 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
# 分发整合后的文件到其它节点
scp ~/.ssh/authorized_keys 172.17.100.107:~/.ssh/
scp ~/.ssh/authorized_keys 172.17.100.108:~/.ssh/
scp ~/.ssh/authorized_keys 172.17.100.120:~/.ssh/
(重新来过的话执行:rm -rf /root/.ssh/ ,然后照着前面再进行配置)
网友评论