Saltstack_使用指南15_多master

 

1. 主机规划

实现2个master,当这两个master运行时都可以向minion发送命令。

 

salt 版本

1 [root@salt100 ~]# salt --version
2 salt 2018.3.3 (Oxygen)
3 [root@salt100 ~]# salt-minion --version
4 salt-minion 2018.3.3 (Oxygen)

 

salt 多master文档

https://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html    

 

2. 多master架构

说明:

根据规划在salt01创建冗余的master。

 

3. 多master实现步骤

3.1. 创建冗余的master

yum install -y salt-master    

 

3.2. 拷贝主master的key和配置到冗余的master

1 # 拷贝的秘钥
2 /etc/salt/pki/master/master.pem
3 /etc/salt/pki/master/master.pub
4 # 拷贝主master的配置
5 /etc/salt/master
6 # 拷贝主master的目录
7 /srv

 

3.3. 启动冗余master

1 systemctl enable salt-master.service  # 开机自启动
2 systemctl start salt-master.service   # 启动salt-master

 

3.4. 配置minion去连接冗余master并重启minion

每台minion机器都操作

 1 [root@salt02 ~]# vim /etc/salt/minion
 2 …………
 3 # Set the location of the salt master server. If the master server cannot be
 4 # resolved, then the minion will fail to start.
 5 #master: salt
 6 # 修改后的配置如下
 7 master:
 8   - salt100
 9   - salt01
10 …………
11 [root@salt02 ~]# systemctl restart salt-minion.service 

 

3.5. 在冗余master接受minion的key

 1 [root@salt01 ~]# salt-key 
 2 Accepted Keys:
 3 Denied Keys:
 4 Unaccepted Keys:
 5 salt01
 6 salt02
 7 salt03
 8 salt100
 9 Rejected Keys:
10 [root@salt01 ~]# salt-key -A  
11 The following keys are going to be accepted:
12 Unaccepted Keys:
13 salt01
14 salt02
15 salt03
16 salt100
17 Proceed? [n/Y] Y
18 Key for minion salt01 accepted.
19 Key for minion salt02 accepted.
20 Key for minion salt03 accepted.
21 Key for minion salt100 accepted.

 

4. 多master操作示例

1 salt '*' pillar.items 
2 salt '*' pillar.item level1:level2:my_user:0 
3 salt '*' grains.item roles 

 

———————————————END———————————————

 

posted on 2019-05-28 20:54 踏歌行666 阅读(...) 评论(...) 编辑 收藏

导航