标签:linux
1.1 安装epel源
# cd /usr/local/src/
# wget http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
1.2 安装rpmforge
这步很重要,在redhat 6和centos 6的epel源上没有python-jinja2,一开始安装变卡在这了.
1 wgethttp://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm-Uvh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
2. 安装依赖包
yum install python-jinja2
3 安装saltstack
只需要一台安装master即可,其他的全部安装minion.
3.1 安装salt-master
# yum -y install salt-master
3.2 安装salt-minion
#yum -y install salt-minion
4 配置saltstack
4.1服务端master的配置
vi /etc/salt/master
interface: 121.41.80.171
看清楚了interface前面有两个空格,这行代码表示我要连接的saltstack的master是121.41.80.171
4.2 minion配置
vi /etc/salt/minion
master: 121.41.80.171
看清楚了master前面有两个空格,这行代码表示我要连接的saltstack的master是121.41.80.171
5启动saltstack
5.1 启动master
service salt-master start
5.2 启动minion
service salt-minion start
设置开机自动启动
chkconfig salt-master on
chkconfig salt-minion on
salt-key
Accepted Keys:
Denied Keys:
Unaccepted Keys:
node2
Rejected Keys:
如果Unaccepted Keys里面有内容
salt-key -a node2
执行了这句话后,minion端就出现了 minion_master.pub
远程执行命令
salt ‘*‘ cmd.run "hostname"
salt ‘*‘ cmd.run "df -m"
本文出自 “dba天空” 博客,请务必保留此出处http://9425473.blog.51cto.com/9415473/1683882
标签:linux
原文地址:http://9425473.blog.51cto.com/9415473/1683882