单台master管理多台minion时,master压力过大,存在单点问题,需要对master做高可用
原理说明:
1)minion端配置多个master地址
2)两台master之间的配置文件,状态文件,密钥文件必须相同
方案设计:
1)使用rsync+inotify或sersync实现文件的同步
2)使用nfs共享挂载的方式
1)安装新的master
yum install salt-master -y #注意:先不要启动
2)同步旧master的配置文件,状态文件,密钥文件到新的master上
#配置文件 rsync -avz /etc/salt/master server-two:/etc/salt/ #密钥文件 rsync -avz /etc/salt/pki/master/master.* server-two:/etc/salt/pki/master/ #master的公钥与私钥 #状态文件 rsync -avz /srv server-two:/
3)修改minion配置,重启minion
# vim /etc/salt/minion master: - server-one - server-two # systemctl restart salt-minion
4)启动新master,并测试
systemctl start salt-master salt-key -A -y salt ‘*‘ test.ping
5)实时同步
rsync+inotify
或sersync
方式完成实时同步
脚本思路:
#!/usr/bin/bash Srv_Config=/srv Master_Config=/etc/salt/master Master_New=10.0.0.21 Date=$(date +%F-%T) rsync -avz --delete $Srv_Config $Master_New:/ &>/dev/null && rsync -avz --delete $Master_Config $Master_New:$Master_Config &>/dev/null if [ $? -eq 0 ];then echo "$Date Rsync Salt Config Is Ok!" else echo "$Date Rsync Salt Config Is Err!" fi
待续
原理说明:
1)主控master可以控制一群master,通过syndic将操作命令传输给受控master,受控master来完成对自己旗下minion的管理,并将结果传回主控master,从而实现了主控master对所有minion的间接管理。
2)syndic节点上也需要master,,syndic连接主控master
环境说明:
master | syndic | minion |
10.0.0.11 | 10.0.0.21 | 10.0.0.22 |
原文:https://www.cnblogs.com/hujinzhong/p/11441616.html