Installation of Saltstack
Briefly:
Before the company required to configure the ZABBIX monitoring all servers, in the management of Zabbix, sometimes need to monitor some of the agent performance, the default Zabbix no corresponding template to implement, so you need to write the corresponding script to monitor, In this case, you need to write the script on each agent, because of the number of servers in the company, it feels that the addition of one will be very slow, and time-consuming, the research using saltstack to achieve automated operation and maintenance
Environment:
Role |
Ip |
System |
Owning group |
Salt server |
192.168.186.130 |
centos6.4 |
|
Salt Minion |
192.168.186.129 |
centos6.4 |
Bjwebgroup |
Salt Minion |
192.168.186.128 |
centos6.4 |
Bjwebgroup/bjdbgroup |
Installation reference:
Read the Salt website and some other related documents, refer to the official website and some other documents of God, to achieve the salt installation
Installation steps:
1. Install the SOFTWARE:
It is recommended to use RPM package installation
Install Epel source before installation: (both server side and Minion side are installed)
cd/usr/local/src/
wget http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RPM-IVH epel-release-6-8.noarch.rpm
Server side:
Yum-y Install Salt-master
Minion End:
Yum-y Install Salt-minion
2. File configuration:
Server side:
Vi/etc/salt/master
Remove the #interface:0.0.0.0 comment and modify it to: interface:192.168.186.130 (IP monitored by the server)
Minion End:
Vi/etc/salt/minion
Remove the #master:server comment and modify it to: master:192.168.186.130 (point to server)
Remove the #id: Comment and modify it to: id:192.168.186.129 (minion IP)
3. Start the service:
Server side:
/etc/init.d/salt-master start
Minion End:
/etc/init.d/salt-minion start
4, Certification:
Server side:
[[email protected] salt]# Salt-key [list](see which Minion can be certified, including: Certified, unauthenticated, and rejected)
Accepted Keys:
192.168.186.129
unaccepted Keys:
rejected Keys:
[[email protected] salt]# salt-key-y-a 192.168.186.129 (certified 192.168.186.129)
The following keys is going to be accepted:
unaccepted Keys:
192.168.186.129
Key for Minion 192.168.186.129 accepted.
Note:-A: Add authentication
-Y: Does not need to be interactive, if you do not add the-y parameter will prompt you y/n
[[email protected] salt]# salt-key-y-D 192.168.186.129 (remove authentication from a minion)
Deleting the following keys:
Accepted Keys:
192.168.186.129
Key for minion 192.168.186.129 deleted.
Note: After removing a minion certification, and want to add again, you need to restart the service:
/etc/init.d/salt-master restart
/etc/init.d/salt-minion restart
[[email protected] salt]# salt-key-y-A (-A parameter authentication all minion)
5. Test:
Server side:
[[email protected] salt]# Salt "*" test.ping (Test all Minion)
192.168.186.129:
True
Note: True indicates a normal connection
* denotes all minion, and * must be enclosed in quotation marks
[[email protected] salt]# Salt 192.168.186.129 test.ping (test 129 only)
192.168.186.129:
True
To this salt installation is done, is not very simple!!!
Group:
If the number of Minion is more, we can group minion, the same function minion is divided into a group, and then on the server side to manage a group
Server side:
Vi/etc/salt/master
Find #nodegroups: About 30 lines
Add to:
Nodegroups:
Bjwebgroup: ' 192.168.186.128 '
Bjdbgroup: ' [email protected],192.168.186.129 '
Note: If there are multiple minion a group, separate it with commas and add it in front [email protected]
Each group is quoted in quotation marks.
/etc/init.d/salt-master Restart (restart service)
To test a grouping:
Server side:
[[email protected] httpd]# salt-n bjwebgroup test.ping (managed only for Bjwebgroup group)
192.168.186.128:
True
Note: to operate a group, use the-n parameter
Additional:
To add a new Minion machine at a later stage:
This is for my own reference only, convenient for later use, the reader can skip
New machine: (Minion)
cd/usr/local/src/
wget http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RPM-IVH epel-release-6-8.noarch.rpm
Yum-y Install Salt-minion
Vi/etc/salt/minion
Remove the #master:server comment and modify it to: Master:192.168.186.xxx (point to server)
Remove the #id: Comment and modify it to: Id:192.168.186.xxx (minion IP)
/etc/init.d/salt-minion start
Server side:
Salt-key
Salt-key-y-A 192.168.186.xxx
Salt 192.168.186.xxx test.ping
This article is from the "See" blog, please be sure to keep this source http://732233048.blog.51cto.com/9323668/1640450
Saltstack Management Two installation of the Saltstack