saltstack
1.安装saltstack
server1设置软件仓库并传给server2、3
[root@server1 ~]# cat /etc/yum.repos.d/dvd.repo
[dvd]
name=dvd
baseurl=http://172.25.14.250/rhel7.6
gpgcheck=0
[salt]
name=salt
baseurl=ftp://172.25.14.250/pub/docs/saltstack/rhel7/3000
gpgcheck=0
server1安装软件,启用
查看端口4505和4506是否开启
[root@server1 ~]# yum install -y salt-master.noarch
[root@server1 ~]# systemctl enable --now salt-master.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-master.service to /usr/lib/systemd/system/salt-master.service.
[root@server1 ~]# netstat -antlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3166/sshd
tcp 0 0 0.0.0.0:4505 0.0.0.0:* LISTEN 13665/python
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3265/master
tcp 0 0 0.0.0.0:4506 0.0.0.0:* LISTEN 13671/python
tcp 0 0 172.25.14.1:46566 172.25.14.2:22 TIME_WAIT -
tcp 0 0 172.25.14.1:22 172.25.14.250:58268 ESTABLISHED 3449/sshd: root@pts
tcp 0 0 172.25.14.1:35542 172.25.14.3:22 TIME_WAIT -
tcp6 0 0 :::22 :::* LISTEN 3166/sshd
tcp6 0 0 ::1:25 :::* LISTEN 3265/master
server2、server3安装minion并启用
[root@server2 ~]# yum install -y salt-minion.noarch
[root@server2 ~]# cd /etc/salt/
[root@server2 salt]# ls
cloud cloud.deploy.d cloud.profiles.d master minion pki proxy.d
cloud.conf.d cloud.maps.d cloud.providers.d master.d minion.d proxy roster
[root@server2 salt]# vim minion
master: 172.25.14.1
[root@server2 salt]# systemctl enable --now salt-minion.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /usr/lib/systemd/system/salt-minion.service.
[root@server3 ~]# yum install -y salt-minion.noarch
[root@server3 ~]# cd /etc/salt/
[root@server3 salt]# ls
cloud cloud.deploy.d cloud.profiles.d master minion pki proxy.d
cloud.conf.d cloud.maps.d cloud.providers.d master.d minion.d proxy roster
[root@server3 salt]# vim minion
master: 172.25.14.1
[root@server3 salt]# systemctl enable --now salt-minion.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /usr/lib/systemd/system/salt-minion.service.
server1查看
[root@server1 ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
server2
server3
Rejected Keys:
server1接受keys
[root@server1 ~]# salt-key -A
The following keys are going to be accepted:
Unaccepted Keys:
server2
server3
Proceed? [n/Y] Y
Key for minion server2 accepted.
Key for minion server3 accepted.
[root@server1 ~]# salt-key -L
Accepted Keys:
server2
server3
Denied Keys:
Unaccepted Keys:
Rejected Keys:
server1测试连接是否成功
[root@server1 ~]# salt '*' test.ping
server3:
True
server2:
True
安装lsof
[root@server1 ~]# yum install -y lsof
端口使用状况查看
查看进程作用
[root@server1 ~]# yum install -y python-setproctitle.x86_64
[root@server1 ~]# systemctl restart salt-master
[root@server1 ~]# ps ax
15874 ? Ss 0:00 /usr/bin/python /usr/bin/salt-master ProcessManager
15881 ? S 0:00 /usr/bin/python /usr/bin/salt-master MultiprocessingLoggingQueue
15888 ? Sl 0:00 /usr/bin/python /usr/bin/salt-master ZeroMQPubServerChannel
15891 ? S 0:00 /usr/bin/python /usr/bin/salt-master EventPublisher
15892 ? S 0:00 /usr/bin/python /usr/bin/salt-master Maintenance
15893 ? S 0:00 /usr/bin/python /usr/bin/salt-master ReqServer_ProcessManager
15894 ? Sl 0:00 /usr/bin/python /usr/bin/salt-master MWorkerQueue
15895 ? S 0:00 /usr/bin/python /usr/bin/salt-master MWorker-0
15896 ? S 0:00 /usr/bin/python /usr/bin/salt-master MWorker-1
15897 ? Sl 0:00 /usr/bin/python /usr/bin/salt-master FileserverUpdate
15906 ? S 0:00 /usr/bin/python /usr/bin/salt-master MWorker-2
15907 ? S 0:00 /usr/bin/python /usr/bin/salt-master MWorker-3
15908 ? S 0:00 /usr/bin/python /usr/bin/salt-master MWorker-4
15940 ? R 0:00 /usr/bin/python /usr/bin/salt-master MWorker-2
15941 ? R 0:00 /usr/bin/python /usr/bin/salt-master MWorker-3
15942 ? R 0:00 /usr/bin/python /usr/bin/salt-master MWorker-4
15943 ? R 0:00 /usr/bin/python /usr/bin/salt-master MWorker-1
15944 pts/0 R+ 0:00 ps ax
15945 ? R 0:00 /usr/bin/python /usr/bin/salt-master MWorker-0