首页 > 代码库 > Saltstack 安装
Saltstack 安装
Saltstack 安装应用
master 192.168.20.156
minion 192.168.20.168
一、系统准备
[root@master ~]# uname -r
2.6.32-504.el6.x86_64
# salt --version
salt 2016.3.3 (Boron)
1、设置关闭 selinux
[root@master ~]# cat /etc/sysconfig/selinux |grep -v ^#
SELINUX=disabled
SELINUXTYPE=targeted
2、设置iptables
# iptables -A INPUT -p tcp --dport 4505 -j ACCEPT
# iptables -A INPUT -p tcp --dport 4506 -j ACCEPT
# /etc/init.d/iptables save
3、安装 gcc c++
# yum install gcc gcc-c++ -y
4、配置yum 源
# cat /etc/yum.repos.d/saltstack.repo
[saltstack]
name=saltstack
baseurl=https://repo.saltstack.com/yum/rhel6/
enabled=1
gpgcheck=0
# rhel7 可以以此更改URL 安装源;
或者wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
或者rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 本人使用这个
5、安装配置
master:
# yum install salt-master salt-minion salt-ssh salt-syndic salt-cloud -y
6、配置master
# mkdir /srv/{salt,pillar}
# cat /etc/salt/master
interface: 192.168.20.156
# 绑定master通信IP
publish_port: 4505
master_id: master
auto_accept: True
# 打开key的自动验证
pidfile: /var/run/salt-master.pid
pki_dir: /etc/salt/pki
file_roots:
base:
- /srv/salt
# 指定saltstack文件根目录位置
pillar_roots:
base:
- /srv/pillar
# 指定pillar的配置目录
#
当/etc/salt/master没有配置auto_accept: True时,需要通过salt-key命令来进行证书认证操作
salt-key -L 显示已认证或未认证的被控端id
salt-key -D 删除所有认证主机id证书
salt-key -d id 删除单个id证书
salt-key -A 接受所有id证书
salt-key -a id 接受单个id证书
salt-key -j id 拒绝单个id证书
salt-key –J 拒绝所有id证书
#
7、启动
# service salt-master start
# chkconfig salt-master on
8、minion 端:
# yum install salt-minion -y
配置 minion
[root@client ~]# cat /etc/salt/minion
master: 192.168.20.168
id: client
9、启动
# service salt-minion start
# chkconfig salt-minion on
10、向客户端发送命令检测;
[root@master ~]# salt-key -L
# 查看minion 列表
[root@master ~]# salt ‘client‘ test.ping
二、提示问题:
# salt ‘*‘ test.ping
[ERROR] Salt request timed out. If this error persists, worker_threads may need to be increased.
Failed to authenticate! This is most likely because this user is not permitted to execute commands, but there is a small possibility that a disk error occurred (check disk/inode usage).
Salt因为握手不成功报错[要求增加线程]解决办法?一般都是配置问题
解决方法:
检测配置文件 /etc/salt/master里面的worker_threads 参数
检测 IPtables和4506 4505 端口;
本文出自 “系统网站运维” 博客,请务必保留此出处http://cgc243652136qq.blog.51cto.com/3989433/1870644
Saltstack 安装