环境:http://www.cnblogs.com/zzzhfo/p/6126223.html
在添加一台master
把master的/etc/salt目录下的pki打包 上传至第二台master的/etc/salt目录下;然后修改minion端/etc/hosts 把salt 指向新的master、重启服务。
- 打包文件
[[email protected] salt]# tar -czf pki.tar.gz pki [[email protected]-server salt]# ls master pki pki.tar.gz 使用lrzsz下载到本地 [[email protected]-server salt]# sz pki.tar.gz 新的master主机操作 使用lrzsz上传到/etc/salt下 [[email protected]-server02 salt]# rz [[email protected]-server02 salt]# tar -xzf pki.tar.gz [[email protected]-server02 salt]# /etc/init.d/salt-master start Starting salt-master daemon:
- 修改minion的hosts
[[email protected] salt]# salt ‘*‘ cmd.run ‘grep salt /etc/hosts‘ salt-client-02: 192.168.119.132 salt salt-minion-01: 192.168.119.132 salt [[email protected]-server salt]# salt ‘*‘ cmd.run "sed -i ‘s#132#129#‘ /etc/hosts" #改为新的master的IP salt-client-02: salt-minion-01: [[email protected]-server salt]# salt ‘*‘ cmd.run ‘grep salt /etc/hosts‘ salt-client-02: 192.168.119.129 salt salt-minion-01: 192.168.119.129 salt
- 重启服务
[[email protected] salt]# salt ‘*‘ service.restart salt-minion salt-minion-01: True salt-client-02: True
查看minion服务是否正常
[[email protected]02 /]# ps -ef | grep salt root 1459 1 0 08:36 ? 00:00:00 /usr/bin/python2.6 /usr/bin/salt-minion -d root 1464 1154 0 08:36 pts/0 00:00:00 grep salt [[email protected]-minion-01 /]# ps -ef | grep salt root 1418 1 1 01:27 ? 00:00:00 /usr/bin/python2.6 /usr/bin/salt-minion -d root 1423 1176 0 01:27 pts/1 00:00:00 grep salt
在新的master主机上测试
[[email protected] salt]# salt ‘*‘ test.ping salt-client-02: True salt-minion-01: True
时间: 2024-10-16 21:39:30