Salt-Syndic
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Salt-Syndic相关的知识,希望对你有一定的参考价值。
理论介绍
一个基本的salt配置方式是一个master指挥一群minion,为了不再有假设使用任何单一拓扑结构,考虑多种布局的情况下,主控master可以控制一群master,通过syndic将操作命令传输给受控master,受控master来完成对自己旗下minion的管理,并将结果传回主控master,从而实现了主控master对所有minion的间接管理。
注意:
Syndic上得master配置文件里得file_roots,pillar_roots与主master一致
Syndic 必须运行在master上,并且连接到另一个master(比他更高级)
syndic有点类似于代理,本质上对与主master来说还是minion
数据走向
主master-------syndic-----syndic-master---------minion
salt-minion--------syndic--------主master
实验结构图:
主机说明:
Host IP salt类型
node1 192.168.10.129 salt-master
node2 192.168.10.128 salt-syndic(salt-master)
node1 192.168.10.129 salt-minion
node2 192.168.10.128 salt-minion
编辑主master配置文件以支持syndic
[[email protected] ~]# vim /etc/salt/master order_masters: True [[email protected] ~]# /etc/init.d/salt-master restart
编辑syndic上的master
[[email protected] ~]# yum install -y salt-master salt-syndic [[email protected] ~]# vim /etc/salt/master syndic_master: 192.168.10.129 #指定主master地址 [[email protected] ~]# /etc/init.d/salt-master start [[email protected] ~]# /etc/init.d/salt-syndic start
由于之前搭过master-minion的环境,现在将其key删除(没有的搭过的可以跳过这步)
[[email protected] ~]# /etc/init.d/salt-minion stop [[email protected] ~]# /etc/init.d/salt-minion stop [[email protected] ~]# salt-key -D The following keys are going to be deleted: Accepted Keys: node1 node2 Proceed? [N/y] y Key for minion node1 deleted. Key for minion node2 deleted. [[email protected] ~]# salt-key [[email protected] minion]# cd /etc/salt/pki/minion/ [[email protected] minion]# ll total 12 -rw-r--r--. 1 root root 451 Aug 22 20:22 minion_master.pub -r--------. 1 root root 1679 Aug 22 20:21 minion.pem -rw-r--r--. 1 root root 451 Aug 22 20:21 minion.pub [[email protected] minion]# rm -rf ./* [[email protected] ~]# cd /etc/salt/pki/minion/ [[email protected] minion]# ll total 16 -rw-r--r--. 1 root root 451 Aug 22 20:22 minion_master.pub -r--------. 1 root root 1675 Aug 22 20:21 minion.pem -rw-r--r--. 1 root root 451 Aug 22 20:21 minion.pub -rw-r--r--. 1 root root 451 Aug 23 02:15 syndic_master.pub [[email protected] minion]# rm -rf ./*
给minion指定master(这里指定的是syndic)
[[email protected] salt]# vim /etc/salt/minion master: 192.168.10.128 [[email protected] salt]# vim /etc/salt/minion master: 192.168.10.128 [[email protected] salt]# /etc/init.d/salt-minion start [[email protected] minion]# /etc/init.d/salt-minion start
通过key建立minion和master的联系
[[email protected] ~]# salt-key -A The following keys are going to be accepted: Unaccepted Keys: node1 #syndic接收node1上的minion的key node2 #syndic接收node2上的minion的key Proceed? [n/Y] y Key for minion node1 accepted. Key for minion node2 accepted. [[email protected] ~]# salt-key -L Accepted Keys: node1 node2 Denied Keys: Unaccepted Keys: Rejected Keys:
[[email protected] salt]# salt-key -A The following keys are going to be accepted: Unaccepted Keys: node2 #接收node2syndic的key Proceed? [n/Y] y Key for minion node2 accepted. [[email protected] salt]# salt-key -L Accepted Keys: node2 Denied Keys: Unaccepted Keys: Rejected Keys: [[email protected] salt
主master和syndic-master都管理两个minion
[[email protected] salt]# salt ‘*‘ test.ping node1: True node2: True [[email protected] ~]# salt ‘*‘ test.ping node1: True node2: True
注:https://docs.saltstack.com/en/latest/topics/topology/syndic.html
本文出自 “feng” 博客,请务必保留此出处http://fengxiaoli.blog.51cto.com/12104465/1958790
以上是关于Salt-Syndic的主要内容,如果未能解决你的问题,请参考以下文章
Saltstack--------部署keepalived,Job管理,salt-ssh,salt-syndic,salt-api