saltstack 簡介
Saltstack使用Python開發,是一個非常簡單易用和輕量級的管理工具,由Master和Minion構成,通過ZeroMQ進行通信,速度快
Saltstack的master端監聽4505與4506埠,4505為salt的訊息發布系統,4506為salt客戶端與服務端通信的埠
salt客戶端程式不監聽埠,客戶端啟動后,會主動連接master端注冊,然后一直保持該TCP連接,master通過這條TCP連接對客戶端控制
部署服務
準備兩臺Centos7 虛擬機

關掉防火墻 setenforce
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
獲取saltstack源
[root@localhost ~]# yum -y install wget
[root@localhost ~]# wget -P /etc/yum.repos.d https://mirrors.aliyun.com/saltstack/yum/redhat/7.2/x86_64/saltstack-rhel7.repo
主服務操作
[root@localhost ~]# yum -y install salt-master salt-minion
[root@localhost ~]# vim /etc/salt/minion
master: 192.168.27.137 #改成本機ip
[root@localhost ~]# systemctl start salt-minion salt-master
[root@localhost ~]# netstat -nlput |egrep "4505|4506"
tcp 0 0 0.0.0.0:4505 0.0.0.0:* LISTEN 13645/python
tcp 0 0 0.0.0.0:4506 0.0.0.0:* LISTEN 13653/python
客戶端操作
[root@localhost ~]# yum -y install salt-minion
[root@localhost ~]# vim /etc/salt/minion
master: 192.168.27.137 服務端ip
[root@localhost ~]# systemctl start salt-minion
[root@localhost ~]#
salt-key常用引數
- -a 添加指定ID 的key
- -A 添加全部
- -R 拒絕全部
- -d 洗掉指定ID的
- -D 洗掉全部
- -L 查詢所有接收到的證書
指定查看認證
[root@localhost ~]# salt-key -a 192.168.27.138
The following keys are going to be accepted:
Unaccepted Keys:
192.168.27.138
Proceed? [n/Y] y
Key for minion 192.168.27.138 accepted.
[root@localhost ~]# salt-key -a 192.168.27.137
The following keys are going to be accepted:
Unaccepted Keys:
192.168.27.137
Proceed? [n/Y] y
Key for minion 192.168.27.137 accepted.
[root@localhost ~]# salt-key -L
Accepted Keys: #已經接受的key
192.168.27.137
192.168.27.138
Denied Keys: #拒絕的key
Unaccepted Keys: #未加入的key
Rejected Keys: #吊銷的key
測驗ping 連接
[root@localhost ~]# salt '*' test.ping
192.168.27.138:
True
192.168.27.137:
True
[root@localhost ~]# salt 192.168.27.138 cmd.run 'hostname'
192.168.27.138:
localhost.localdomain
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/216218.html
標籤:其他
上一篇:利用阿里云服務器和frp進行內網穿透,實作遠程訪問內網ip服務器
下一篇:intellij idea 中tomcat報錯Error during artifact deployment. See server log for details.
