saltstack中如何實現多個master來管理minion

背景:服務器

  公司有多個部門,有一些機器有本部門的業務,這些機器也有其餘部門的業務,因此本部門須要一個master服務器來管理這批機器,其餘部門也須要一個master服務器來管理這個機器,因此就須要多個master來進行管理。測試

實現:spa

  實現方式就是全部的master服務器使用相同的private key,即咱們只須要將其中一臺已經配置好的master上的private key進行復制,而後拷貝到另外一臺master服務器上便可,而後在minion端配置好minion id便可,配置完成後須要重啓下服務。code

示例:blog

準備了三臺機器io

機器列表 狀態
192.168.235.133 master1
192.168.235.134 minion
192.168.235.135 master2

1)將master2上的private key進行拷貝至master1上table

[root@localhost master]# ll
總用量 8
-r--------. 1 root root 1679 1月   2 21:19 master.pem    #private key
-rw-r--r--. 1 root root  451 1月   2 21:19 master.pub
drwxr-xr-x. 2 root root   15 1月   2 21:20 minions
drwxr-xr-x. 2 root root    6 1月   2 21:19 minions_autosign
drwxr-xr-x. 2 root root    6 1月   2 21:19 minions_denied
drwxr-xr-x. 2 root root    6 1月   2 21:20 minions_pre
drwxr-xr-x. 2 root root    6 1月   2 21:19 minions_rejected

 private key 所在目錄:/etc/salt/pki/master

2)修改minion端的配置文件ast

 

 書寫格式必定要寫對class

3)而後在master1上進行密鑰認證配置

[root@localhost master]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
m1
Rejected Keys:
[root@localhost master]# salt-key -A
The following keys are going to be accepted:
Unaccepted Keys:
m1
Proceed? [n/Y] Y
Key for minion m1 accepted.

4)重啓服務,測試便可

須要注意的是:另外一個master不能有其餘節點服務器鏈接

以上操做便實現了多個master共同管理minion節點的需求了

相關文章
相關標籤/搜索