salt-syndic

Posted 码出未来_远

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了salt-syndic相关的知识,希望对你有一定的参考价值。

salt-syndic

文章目录

salt-syndic分布式架构

salt-syndic架构图

salt-syndic的优劣势

优势:

  • 可以通过syndic实现更复杂的salt架构
  • 减轻master的负担

劣势:

  • syndic的/srv目录下的salt和pillar目录内容要与最顶层的master下的一致,所以要进行数据同步,同步方案同salt-master高可用
  • 最顶层的master不知道自己有几个syndic,它只知道自己有多少个minion,并不知道这些minion是由哪些syndic来管理的
主机IP角色安装的应用
192.168.207.131Mastersalt-master
192.168.207.137Syndicsalt-master salt-syndic
192.168.207.136Minionsalt-minion
192.168.207.255Minionsalt-minion

安装salt-master与salt-syndic

192.168.207.137上安装salt-mastersalt-syndic`,安装前请自行配置yum源

[root@syndic ~]# yum -y install salt-master salt-syndic

配置master

修改master的master配置文件

  • 取消注释order_master
  • 将order_master的值设为True
[root@master ~]# vim /etc/salt/master
.....此处省略N行
# masters' syndic interfaces.
order_masters: True

[root@master ~]# systemctl enable salt-master
[root@master ~]# systemctl restart salt-master

配置syndic

修改syndic所在主机的master配置文件

  • 取消注释syndic_master
  • 将syndic_master的值设为master的IP
[root@syndic ~]# vim /etc/salt/master
.....此处省略N行
syndic_master: 192.168.207.137

[root@syndic ~]# systemctl enable salt-master
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-master.service to /usr/lib/systemd/system/salt-master.service.
[root@syndic ~]# systemctl enable salt-syndic
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-syndic.service to /usr/lib/systemd/system/salt-syndic.service.
[root@syndic ~]# systemctl restart salt-master
[root@syndic ~]# systemctl restart salt-syndic

配置minion

配置minion,将master指向syndic所在主机

[root@node1 ~]# vim /etc/salt/minion
master: 192.168.207.131
[root@node1 ~]# systemctl restanion
[root@node1 ~]# systemctl enablion
Created symlink /etc/systemd/sy-user.target.wants/salt-minion./usr/lib/systemd/system/salt-mice.
[root@node2 ~]# vim /etc/salt/minion
master: 192.168.207.131
[root@node2 ~]# systemctl restanion
[root@node2 ~]# systemctl enablion
Created symlink /etc/systemd/sy-user.target.wants/salt-minion./usr/lib/systemd/system/salt-mice.

在所有minion上做同样的操作,注意,要设置minion配置文件中的id参数,指向minion自身的ip地址或主机名,必须能够唯一标识minion本机。

在syndic上接受minion主机的key

[root@Syndic ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
node1
node2
Rejected Keys:
[root@Syndic ~]# salt-key -yA
The following keys are going to be accepted:
Unaccepted Keys:
node1
node2
Key for minion node1 accepted.
Key for minion node2 accepted.
[root@Syndic ~]# salt-key -L
Accepted Keys:
node1
node2
Denied Keys:
Unaccepted Keys:
Rejected Keys:

在master上接受syndic主机的key

[root@master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
Syndic
Rejected Keys:
[root@master ~]# salt-key -yAThe following keys are going to be accepted:
Unaccepted Keys:
Syndic
Key for minion Syndic accepted.

在master上执行模块或状态检验有几个minion应答

[root@master ~]# salt '*' test.ping
Syndic:
    Minion did not return. [No response]
    The minions may not have all finished running and any remaining minions will return upon completion. To look up the return data for this job later, run the following command:
    
    salt-run jobs.lookup_jid 20210722105354534923
ERROR: Minions returned with non-zero exit code
[root@master ~]# salt '*' test.ping
node1:
    True
node2:
    True

以上是关于salt-syndic的主要内容,如果未能解决你的问题,请参考以下文章

salt-syndic

salt-syndic

Salt-Syndic

Saltstack--------部署keepalived,Job管理,salt-ssh,salt-syndic,salt-api

减轻 访问SQL Server数据库的负担,该怎么做???

手动 SIMD 代码的可负担性 [关闭]