SaltStack,一种全新的基础设施管理方式,部署轻松,在几分钟内可运行起来,扩展性好,很容易管理上万台服务器,速度够快,服务器之间秒级通讯。
salt底层采用动态的连接总线, 使其可以用于编配, 远程执行, 配置管理等等.
Server:CentoOS 7.0
Salt-master: 192.168.254.131 (管理端)
Salt-minion: 192.168.254.132 (被管理端)
1.在master和minion主机上均安装epel
[root@salt-master ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@salt-master ~]# rpm -qa | grep epel
epel-release-7-8.noarch
2.在master主机上安装salt-master并加入开机启动
[root@salt-master ~]# yum install salt-master -y
[root@salt-master ~]# rpm -qa | grep salt-master
salt-master-2015.5.10-2.el7.noarch
[root@salt-master ~]# systemctl enable salt-master.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-master.service to /usr/lib/systemd/system/salt-master.service.
3.master主机启动salt-master服务,并确认进程
[root@salt-minion ~]# systemctl start salt-master.service
4.minion主机上安装salt-minion并加入开机启动
[root@salt-minion ~]# yum install salt-minion -y
[root@salt-minion ~]# rpm -qa | grep salt-minion
salt-minion-2015.5.10-2.el7.noarch
[root@salt-minion ~]# systemctl enable salt-minion.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /usr/lib/systemd/system/salt-minion.service.
5.minion主机上启动minion服务,并确认其进程
[root@salt-minion ~]# systemctl start salt-minion.service
6.配置minion上的配置文件
[root@salt-minion ~]# vi /etc/salt/minion
填写master端的IP指向
至此,安装完毕,master和minion两主机可以通信了。下面介绍一下salt-key的操作
salt-key操作(master端)
列出当前所有Key
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
Rejected Keys:
如果发现没有minion的信息,多是防火墙原因,关闭或重新设置一下防火墙
[root@salt-master ~]# firewall-cmd --state
running
[root@salt-master ~]# systemctl stop firewalld.service
[root@salt-master ~]# firewall-cmd --state
not running
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
salt-minion
Rejected Keys:
此时可以看到minion的主机名了,只是目前还处于[Unaccepted Keys:]的状态
接受一个ID为salt-minion的Key,ID的值在minion的/etc/salt/minion中修改【id: xxxxx】
[root@salt-master ~]# salt-key -a salt-minion
The following keys are going to be accepted:
Unaccepted Keys:
salt-minion
Proceed? [n/Y] Y
Key for minion salt-minion accepted.
[root@salt-master ~]# salt-key -L
Accepted Keys:
salt-minion
Denied Keys:
Unaccepted Keys:
Rejected Keys:
接受所有Key
# salt-key -A
删除ID为CentOS的key
# salt-key -d CentOS
删除所有的key
# salt-key -D
查看key指纹(master)
[root@salt-master ~]# salt-key -f CentOS
Accepted Keys:
salt-minion: 54:6d:70:6c:80:12:49:62:99:66:8f:06:b8:4c:eb:0e
查看key指纹(minion)
[root@salt-minion ~]# salt-call key.finger --local
local:
54:6d:70:6c:80:12:49:62:99:66:8f:06:b8:4c:eb:0e
执行测试在线命令
[root@salt-master ~]# # salt "*" test.ping
salt-minion:
True
其中【*】代表所有客户端,把*换成id代表只是选中这个id的客户端
返回true说明客户端在线
执行远程命令
[root@salt-master ~]# salt "*" cmd.run "uname -a"
salt-minion:
Linux CentOS 3.10.0-327.28.3.el7.x86_64 #1 SMP Thu Aug 18 19:05:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@salt-master ~]# salt "*" cmd.run "ip ro sh"
salt-minion:
default via 192.168.254.2 dev eno16777736 proto static metric 100
192.168.254.0/24 dev eno16777736 proto kernel scope link src 192.168.254.132 metric 100vSaltStack,一种全新的基础设施管理方式,部署轻松,在几分钟内可运行起来,扩展性好,很容易管理上万台服务器,速度够快,服务器之间秒级通讯。
salt底层采用动态的连接总线, 使其可以用于编配, 远程执行, 配置管理等等.
Server:CentoOS 7.0
Salt-master: 192.168.254.131 (管理端)
Salt-minion: 192.168.254.132 (被管理端)
1.在master和minion主机上均安装epel
[root@salt-master ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@salt-master ~]# rpm -qa | grep epel
epel-release-7-8.noarch
2.在master主机上安装salt-master并加入开机启动
[root@salt-master ~]# yum install salt-master -y
[root@salt-master ~]# rpm -qa | grep salt-master
salt-master-2015.5.10-2.el7.noarch
[root@salt-master ~]# systemctl enable salt-master.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-master.service to /usr/lib/systemd/system/salt-master.service.
3.master主机启动salt-master服务,并确认进程
[root@salt-minion ~]# systemctl start salt-master.service
4.minion主机上安装salt-minion并加入开机启动[root@salt-minion ~]# yum install salt-minion -y
[root@salt-minion ~]# rpm -qa | grep salt-minion
salt-minion-2015.5.10-2.el7.noarch
[root@salt-minion ~]# systemctl enable salt-minion.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /usr/lib/systemd/system/salt-minion.service.
5.minion主机上启动minion服务,并确认其进程
[root@salt-minion ~]# systemctl start salt-minion.service
6.配置minion上的配置文件[root@salt-minion ~]# vi /etc/salt/minion
填写master端的IP指向
至此,安装完毕,master和minion两主机可以通信了。下面介绍一下salt-key的操作salt-key操作(master端)
列出当前所有Key
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
Rejected Keys:
如果发现没有minion的信息,多是防火墙原因,关闭或重新设置一下防火墙
[root@salt-master ~]# firewall-cmd --state
running
[root@salt-master ~]# systemctl stop firewalld.service
[root@salt-master ~]# firewall-cmd --state
not running
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
salt-minion
Rejected Keys:
此时可以看到minion的主机名了,只是目前还处于[Unaccepted Keys:]的状态
接受一个ID为salt-minion的Key,ID的值在minion的/etc/salt/minion中修改【id: xxxxx】
[root@salt-master ~]# salt-key -a salt-minion
The following keys are going to be accepted:
Unaccepted Keys:
salt-minion
Proceed? [n/Y] Y
Key for minion salt-minion accepted.
[root@salt-master ~]# salt-key -L
Accepted Keys:
salt-minion
Denied Keys:
Unaccepted Keys:
Rejected Keys:
接受所有Key
# salt-key -A
删除ID为CentOS的key
# salt-key -d CentOS
删除所有的key
# salt-key -D
查看key指纹(master)
[root@salt-master ~]# salt-key -f CentOS
Accepted Keys:
salt-minion: 54:6d:70:6c:80:12:49:62:99:66:8f:06:b8:4c:eb:0e
查看key指纹(minion)
[root@salt-minion ~]# salt-call key.finger --local
local:
54:6d:70:6c:80:12:49:62:99:66:8f:06:b8:4c:eb:0e
执行测试在线命令
[root@salt-master ~]# # salt "*" test.ping
salt-minion:
True
其中【*】代表所有客户端,把*换成id代表只是选中这个id的客户端
返回true说明客户端在线
执行远程命令
[root@salt-master ~]# salt "*" cmd.run "uname -a"
salt-minion:
Linux CentOS 3.10.0-327.28.3.el7.x86_64 #1 SMP Thu Aug 18 19:05:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@salt-master ~]# salt "*" cmd.run "ip ro sh"
salt-minion:
default via 192.168.254.2 dev eno16777736 proto static metric 100
192.168.254.0/24 dev eno16777736 proto kernel scope link src 192.168.254.132 metric 100SaltStack,一种全新的基础设施管理方式,部署轻松,在几分钟内可运行起来,扩展性好,很容易管理上万台服务器,速度够快,服务器之间秒级通讯。
salt底层采用动态的连接总线, 使其可以用于编配, 远程执行, 配置管理等等.
Server:CentoOS 7.0
Salt-master: 192.168.254.131 (管理端)
Salt-minion: 192.168.254.132 (被管理端)
1.在master和minion主机上均安装epel
[root@salt-master ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@salt-master ~]# rpm -qa | grep epel
epel-release-7-8.noarch
2.在master主机上安装salt-master并加入开机启动
[root@salt-master ~]# yum install salt-master -y
[root@salt-master ~]# rpm -qa | grep salt-master
salt-master-2015.5.10-2.el7.noarch
[root@salt-master ~]# systemctl enable salt-master.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-master.service to /usr/lib/systemd/system/salt-master.service.
3.master主机启动salt-master服务,并确认进程
[root@salt-minion ~]# systemctl start salt-master.service
4.minion主机上安装salt-minion并加入开机启动[root@salt-minion ~]# yum install salt-minion -y
[root@salt-minion ~]# rpm -qa | grep salt-minion
salt-minion-2015.5.10-2.el7.noarch
[root@salt-minion ~]# systemctl enable salt-minion.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /usr/lib/systemd/system/salt-minion.service.
5.minion主机上启动minion服务,并确认其进程
[root@salt-minion ~]# systemctl start salt-minion.service
6.配置minion上的配置文件[root@salt-minion ~]# vi /etc/salt/minion
填写master端的IP指向
至此,安装完毕,master和minion两主机可以通信了。下面介绍一下salt-key的操作salt-key操作(master端)
列出当前所有Key
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
Rejected Keys:
如果发现没有minion的信息,多是防火墙原因,关闭或重新设置一下防火墙
[root@salt-master ~]# firewall-cmd --state
running
[root@salt-master ~]# systemctl stop firewalld.service
[root@salt-master ~]# firewall-cmd --state
not running
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
salt-minion
Rejected Keys:
此时可以看到minion的主机名了,只是目前还处于[Unaccepted Keys:]的状态
接受一个ID为salt-minion的Key,ID的值在minion的/etc/salt/minion中修改【id: xxxxx】
[root@salt-master ~]# salt-key -a salt-minion
The following keys are going to be accepted:
Unaccepted Keys:
salt-minion
Proceed? [n/Y] Y
Key for minion salt-minion accepted.
[root@salt-master ~]# salt-key -L
Accepted Keys:
salt-minion
Denied Keys:
Unaccepted Keys:
Rejected Keys:
接受所有Key
# salt-key -A
删除ID为CentOS的key
# salt-key -d CentOS
删除所有的key
# salt-key -D
查看key指纹(master)
[root@salt-master ~]# salt-key -f CentOS
Accepted Keys:
salt-minion: 54:6d:70:6c:80:12:49:62:99:66:8f:06:b8:4c:eb:0e
查看key指纹(minion)
[root@salt-minion ~]# salt-call key.finger --local
local:
54:6d:70:6c:80:12:49:62:99:66:8f:06:b8:4c:eb:0e
执行测试在线命令
[root@salt-master ~]# # salt "*" test.ping
salt-minion:
True
其中【*】代表所有客户端,把*换成id代表只是选中这个id的客户端
返回true说明客户端在线
执行远程命令
[root@salt-master ~]# salt "*" cmd.run "uname -a"
salt-minion:
Linux CentOS 3.10.0-327.28.3.el7.x86_64 #1 SMP Thu Aug 18 19:05:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@salt-master ~]# salt "*" cmd.run "ip ro sh"
salt-minion:
default via 192.168.254.2 dev eno16777736 proto static metric 100
192.168.254.0/24 dev eno16777736 proto kernel scope link src 192.168.254.132 metric 100