Saltstack_使用指南15_多master

 

1. 主機規劃

實現2個master,當這兩個master運行時均可以向minion發送命令。html

 

salt 版本vim

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架構

說明:spa

根據規劃在salt01建立冗餘的master。rest

 

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機器都操做code

 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———————————————server

相關文章
相關標籤/搜索