I. Description of ZEROMQ
We carry out automated operations in most cases, the number of our servers has far exceeded the scope of human SSH maintenance, Saltstack can support thousands or even more servers, these performance is mainly from the ZEROMQ, Because Saltstack is based on ZEROMQ for efficient network communication, ZMQ is used for communication between node and node, and node can be either a host or a process.
Ii. introduction of ZEROMQ
ZeroMQ (which we usually OMQ,ZMQ) is a simple and easy-to-use transport layer, a framework-like socket library that uses a more simple, concise, and high-performance socket programming, and is a message processing queue repository that elastically scales between multiple threads, cores, and host cores.
Publish and subscribe
The
ZEROMQ supports Publish/subscribe, which is the publish and subscribe model, We are often referred to as pub/sub
Salt Master runs two network services, one of which is the Zeromq pub system, which listens to 4505 ports by default, and can be set by modifying the Publish_port parameter of the/etc/salt/master configuration file. It is a salt message publishing system, and if you look at Port 4505, you will see that all Minion are connected to the 4505 port of master, and the TCP status is persisted to established
[[Email protected] ~] # lsof-i: 4505 COMMAND PID USER FD TYPE DEVICE size/OFF NODE NAME salt-mini 2630 root 24u IPv4 41122 0t0 TCP 172.16.17.12:41314->salt:4505 (established) so Salt Master publishes a message, All minion that are connected to the 4505 pub port will receive this message, and each minion will then determine if it needs to execute the message.
Request and response
ZEROMQ supports request-reply, that is, request and response mode, we often referred to as Req/rep
Salt Master runs the second network service is the ZEROMQ rep system, the default listener 4506 port, you can modify the/etc/salt/master configuration file ret_port parameter settings, he is the salt client communicates with the server port, For example, Minion executes a command after the return value is sent to the 4506 of the rep port master.
Since we initially installed the Python-setproctitle software package, we can see directly the name of the process that the salt master started.
[[Email protected] ~]#ps aux | grep salt/usr/bin/salt-master-d Processmanager#Central Process Manager/usr/bin/salt-master-d _clear_old_jobs#clear old Jobs files and update fileserver/usr/bin/salt-master-d Publisher#Pub The task to the Minion end/usr/bin/salt-master-d Eventpublisher#Event Publisher Process/usr/bin/salt-master-d Reqserver_processmanager#Reqserver Process Manager/usr/bin/salt-master-d Mworker#Work Process/usr/bin/salt-master-d Mworker#Work Process/usr/bin/salt-master-d Mworker#Work Process/usr/bin/salt-master-d Mworker#Work Process/usr/bin/salt-master-d Mworker#Work Process/usr/bin/salt-master-d Mworkerqueue#forwarding RET Interface (ROUTER) data to Worker (DEALER)
Saltstack (Fri) Saltstack and Zeromq