Establishment of enterprise level top master and syndic services and horizontal expansion of master##

Keywords: ssh yum vim

1. Restore environment:
[server1]

[root@server1 _modules]# salt-key -L
Accepted Keys:
server1
server2
server3
server4
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@server1 _modules]# salt-key -d server4
The following keys are going to be deleted:
Accepted Keys:
server4
Proceed? [N/y] y
Key for minion server4 deleteed.

[server4]

[root@server4 modules]# /etc/init.d/salt-minion  stop
Stopping salt-minion:root:server4 daemon: OK
[root@server4 modules]# chkconfig salt-minion off
[root@server4 modules]# /etc/init.d/haproxy stop
Stopping haproxy:                                          [  OK  ]

2. Create a service in [server4]:

[root@server4 modules]# yum install -y salt-master
[root@server4 modules]# cd /etc/salt/
[root@server4 salt]# ls
cloud           cloud.maps.d       master    minion.d   proxy
cloud.conf.d    cloud.profiles.d   master.d  minion_id  proxy.d
cloud.deploy.d  cloud.providers.d  minion    pki        roster
[root@server4 salt]# vim master
[root@server4 salt]# /etc/init.d/salt-master  start
Starting salt-master daemon:                               [  OK  ]

3. Create a service in [server1]:

[root@server1 ~]# cd /etc/salt/
[root@server1 salt]# yum install -y salt-syndic
[root@server1 salt]# ls
cloud           cloud.maps.d       master    minion.d   proxy
cloud.conf.d    cloud.profiles.d   master.d  minion_id  proxy.d
cloud.deploy.d  cloud.providers.d  minion    pki        roster
[root@server1 salt]# vim master
[root@server1 salt]# /etc/init.d/salt-master stop
Stopping salt-master daemon:                               [  OK  ]
[root@server1 salt]# /etc/init.d/salt-master start
Starting salt-master daemon:                               [  OK  ]
[root@server1 salt]# /etc/init.d/salt-syndic start
Starting salt-syndic daemon:                               [  OK  ]


4. After [server1] opens the service sending connection to [server4], there will be a connection request of [server1] in [server4], and then the [server4] sends the key to establish a secret free connection with [server1]:


5. When [server4] topmaster and [server1] sync send instructions, it can inform the master host of the command, and the master can complete the instructions at the command minion end, which can expand the master horizontally

6.ssh command controls the operation of the host, which does not need to download any commands and configurations:
(1) [server3] turns off the salt minion service and disconnects [server1] from [server3]

[root@server3 ~]# /etc/init.d/salt-minion  stop
Stopping salt-minion:root:server3 daemon: OK

(2) Create a service in [server1]:

[root@server1 salt]# yum install -y salt-ssh

(3) Add control host information:

[root@server1 salt]# vim /etc/salt/roster


(4) Test:

[root@server1 salt]# salt-ssh '*' test.ping

[root@server1 salt]# salt-ssh '*' test.ping

Posted by switchdoc on Thu, 02 Jan 2020 13:56:13 -0800