First,salt Introduction
Saltstack is a centralized management platform based on C/s architecture with configuration management, remote execution, monitoring and other functions. With Saltstack, You can deploy services in a single click, execute commands remotely, and greatly increase the productivity of operations personnel in large-scale service clusters.
Saltstack is based on Python language development and communicates using lightweight Message Queuing (ZeroMQ)pub/sub .
Minion is automatically generated at/etc/salt/pki/minion/(which can be set in /etc/salt/minion) at the first time Minion.pem (private key) and minion.pub(Public key), and then sends the minion.pub to master. when Master receives minion 's public key through the salt-key-a command , the/etc/salt/pki/master/in master The minions/ directory will generate a file that holds the Minion public key, and master will then be able to send instructions to minion.
Second,salt installation
Salt uses the YAML language, the Jinja template language,and the ZeroMQ, which do not need to be installed. All you need to do is configure a Epel source, and then execute yum-y install Salt-master, and you'll see that these dependencies have all been installed in the process.
Configure the Epel source on the machine to be managed, perform the Yum-y install Salt-minion complete the client installation.
three,salt configuration
The default configuration files are stored in the/etc/salt/ directory.
Master file configuration:
[[email protected] ~]# sed -e '/^#/d;/^$/d '/etc /salt/masterdefault_include:master.d/*.conftimeout: 60file_roots: #指定文件路径 base: - /etc/salt/states/base #base环境路径 prod: - /etc/salt/states/prod #prod环境路径
Because you are just beginning to learn salt, using these configurations is enough to do a lot of things. The two file paths defined need to be generated manually.
Minion file configuration:
[Email protected] ~]# sed-e '/^#/d;/^$/d '/etc/salt/minionmaster:192.168.199.79id:saltstack.test.com #id可以自定义, it's better to have a certain pattern.
Salt is very simple to configure, but it does so much more than that!
Iv. Start-Up testing
1. Start:
The software used to install Yum on the CentOS series system starts the same way:
[Email protected] ~]# salt-key-laccepted keys:denied keys:unaccep Ted Keys:saltstack.test.comRejected Keys:
2. Test:
(1) View the key list:
[Email protected] ~]# salt-key-laccepted keys:denied keys:unaccep Ted Keys:saltstack.test.comRejected Keys:
As can be seen from the above saltstack.test.com Key has not been received, with the following command to receive all the key not received :
[[Email protected] ~] #salt-key-athe Followingkeys is going to be accepted:unaccepted Keys:saltstack.test.comProceed? [n/y] YKey for Minionsaltstack.test.com Accepted
(2) After the key is received, the command can be executed remotely to minion:
[[Email protected] ~] #salt ' saltstack.test.com ' test.pingsaltstack.test.com:True #使用test. Ping Test with Minion connectivity Of
[[Email protected] ~] #salt ' saltstack.test.com ' cmd.run ' date ' Saltstack.test.com:WedJul 18:51:00 EDT 2016 #使用cmd. Run to execute the date command
Note: when executing a command, you can use the salt ' * ' to add a command to all nodes. However, when working with all nodes, it is a good idea to add test=true to the command followed by the command to see what actions are performed.
This article is from the "Tranquility" blog, so be sure to keep this source http://zhen0522.blog.51cto.com/11834939/1826175
Saltstack one of the Getting Started: Saltstack installation