- SaltStackAnd ZeroMQ
SaltStackThe bottom layer is based on ZeroMQ for efficient network communication.
ØMQ （ZeroMQ, 0MQ or ZMQ is also a high performance asynchronous message library designed for scalable distributed or concurrent applications. It provides a message queue, but unlike message oriented middleware, ZeroMQ does not need specialized message agents (messagE broker). The library is designed as a common socket style API. It provides InProc, IPC, TCP and broadcast channel, and supports fan out (fan-out) and publish subscribe (pub-sub).), task distribution, request / response (request-reply) and other communication modes.
StackThe first pattern: publish and subscribe
ZeroMQSupport Publish/Subscribe, that is, publish and subscribe mode. We are often referred to as Pub/Sub.
Salt MasterRun two network services, one of which is ZeroMQ PUB system, default monitoring.4505port。
You can modify the publish_port parameter settings of the /etc/salt/master configuration file.
It is a salt messaging system, and if you look at the 4505 port, all Minion will be linked to the 4505 port of Master, and the TCP state is kept as ESTABLISHED.
– SaltStackThe first model: request and response
ZeroMQSupport Request-Reply, request and response mode, which is often referred to as REQ/REP.
Salt MasterThe second network service running is the ZeroMQ REP system, which is monitored by default.4506port，You can modify the ret_port parameter settings of the /etc/salt/master configuration file.
It is the port for the salt client to communicate with the server. For example, when Minion executes a command, the return value is the 4506 REP port sent to Master.
If the python-setproctitle package is installed, we can see directly the name of the process initiated by Salt Master.
yum install -y python-setproctitle
Restart master and minion
systemctl restart salt-master systemctl restart salt-minion
/usr/bin/salt-master -d ProcessManager # Central process manager/usr/bin/salt-master -d _clear_old_jobs _clear_old_jobs eliminates old Jobs files and updates fileserver/usr/bin/salt-master -d PUblisher from PUB to Minion/usr/bin/salt-master -d EventPublisher Event Publisher process/usr/bin/salt-master -d ReqServer_ProcessManager ReqServer Process ManagerThe working process of /usr/bin/salt-master -d MWorker/uThe working process of sr/bin/salt-master -d MWorkerThe working process of /usr/bin/salt-master -d MWorker/usr/bin/salt-master -The working process of D MWorkerThe working process of /usr/bin/salt-master -d MWorker/usr/bin/salt-master -d MWorkerQueue ReT interface (ROUTER) data is forwarded to Worker (DEALER)