saltstack安装

本文涉及的产品
全局流量管理 GTM,标准版 1个月
公共DNS(含HTTPDNS解析),每月1000万次HTTP解析
云解析 DNS,旗舰版 1个月
简介:

一、yum安装

安装master端:yum install salt-master -y

安装minion端:yum install salt-minion -y



如果没有yum源

Run the following commands to install the SaltStack repository and key:

sudo yum install https://repo.saltstack.com/yum/redhat/salt-repo-2015.8-2.el7.noarch.rpm 

Run sudo yum clean expire-cache


Install the salt-minion, salt-master, or other Salt components:

sudo yum install salt-master

sudo yum install salt-minion

sudo yum install salt-ssh

sudo yum install salt-syndic

sudo yum install salt-cloud

sudo yum install salt-api


二、源码包安装

wget http://download.zeromq.org/zeromq-4.0.5.tar.gz && tar zxvf zeromq-4.0.5.tar.gz && cd zeromq-4.0.5 && ./autogen.sh && ./configure --prefix=/usr/local && make && make install


yum -y install autoconf libsodium uuid uuid-c++ uuid-devel libuuid libuuid-devel swig.x86_64


/usr/local/python/bin/pip2 install pyyaml

/usr/local/python/bin/pip2 install MarkupSafe

/usr/local/python/bin/pip2 install Jinja2

/usr/local/python/bin/pip2 install pyzmq

/usr/local/python/bin/pip2 install msgpack-python

/usr/local/python/bin/pip2 install msgpack-pure

/usr/local/python/bin/pip2 install pycrypto

/usr/local/python/bin/pip2 install requests

/usr/local/python/bin/pip2 install msgpack-python

/usr/local/python/bin/pip2 install salt


wget https://pypi.python.org/packages/source/s/salt/salt-2015.5.0.tar.gz && tar zxvf salt-2015.5.0.tar.gz  && cd salt-2015.5.0/ && /usr/local/python/bin/python2.7 setup.py  install

wget https://pypi.python.org/packages/source/s/salt/salt-2014.7.5.tar.gz && tar zxvf salt-2015.5.0.tar.gz  && cd salt-2015.5.0/ && /usr/local/python/bin/python2.7 setup.py  install


三、配置文件

(1)、master端


mkdir -p /etc/salt

mkdir -p /usr/local/salt/run

mkdir -p /usr/local/salt/logs

mkdir -p /usr/local/salt/salt

mkdir -p /usr/local/salt/pillar

mkdir -p /usr/local/salt/etc

chown -R monitor.monitor /usr/local/salt



cp -a pkg/suse/salt-master /etc/init.d/

cp -a pkg/suse/salt-master /usr/local/bin/

chmod +x /etc/init.d/salt-master

chkconfig --level 235 salt-master on

ln -s /usr/local/bin/salt-master /usr/bin/


配置文件项

vim /etc/salt/master

#绑定IP

interface: 10.133.33.85

#自动识别KEY

auto_accept: True

#salt运行的用户,影响到salt的执行权限

user: monitor

#salt的运行线程,开的线程越多一般处理的速度越快,但一般不要超过CPU的个数

worker_threads: 10

#master的管理端口

publish_port : 4505

#master跟minion的通讯端口,用于文件服务,认证,接受返回结果等

ret_port : 4506

#如果这个master运行的salt-syndic连接到了一个更高层级的master,那么这个参数需要配置成连接到的这个高层级master的监听端口

syndic_master_port : 4506

#指定pid文件位置

pidfile: /usr/local/salt/run/salt-master.pid

#saltstack 可以控制的文件系统的开始位置

root_dir: /usr/local/salt

#日志文件地址

log_file: /usr/local/salt/logs/salt_master.log

log_datefmt_logfile: '%Y-%m-%d %H:%M:%S'

#导入配置文件

default_include: /usr/local/salt/etc/*.conf

#salt state执行时候的根目录

file_roots:

  base:

    - /usr/local/salt/salt

#设置pillar 的根目录

pillar_roots:

  base:

    - /usr/local/salt/pillar

ext_pillar:

  - hiera: /usr/local/salt/etc/hiera.yaml

  - cmd_yaml: cat /usr/local/salt/etc/salt/yaml


  

启停

service salt-master start

service salt-master stop

service salt-master restart







(2)、minion端

mkdir /etc/salt

cp -a conf/minion /etc/salt/

cp -a pkg/suse/salt-minion /etc/init.d/

chmod +x /etc/init.d/salt-minion

chkconfig --level 235 salt-minion on

ln -s /usr/local/bin/salt-minion /usr/bin/


vim /etc/salt/minion

#minion的识别ID,可以是IP,域名,或是可以通过DNS解析的字符串

id: 10.144.160.124

#salt运行的用户权限

user: monitor

#master的识别ID,可以是IP,域名,或是可以通过DNS解析的字符串

master : 10.251.27.28

#master通讯端口

master_port: 4506

#备份模式,minion是本地备份,当进行文件管理时的文件备份模式

backup_mode: minion

#执行salt-call时候的输出方式

output: nested

#minion等待master接受认证的时间

acceptance_wait_time: 10

#失败重连次数,0表示无限次,非零会不断尝试到设置值后停止尝试

acceptance_wait_time_max: 0

#重新认证延迟时间,可以避免因为master的key改变导致minion需要重新认证的syn风暴

random_reauth_delay: 60

#导入配置文件

default_include: /usr/local/salt/etc/*.conf

#日志文件位置

log_file: /usr/local/salt/logs/salt_minion.log

sock_dir: /usr/local/salt/run

log_datefmt_logfile: '%Y-%m-%d %H:%M:%S'

pidfile: /usr/local/salt/run/salt-minion.pid

#文件路径基本位置

root_dir: /usr/local/salt

file_roots:

  base:

    - /usr/local/salt/salt

#pillar基本位置

pillar_roots:

  base:

    - /usr/local/salt/pillar

 

启停

service salt-minion start

service salt-minion stop

service salt-minion restart






     本文转自aaron428 51CTO博客,原文链接:http://blog.51cto.com/aaronsa/1740609,如需转载请自行联系原作者
相关文章
|
消息中间件 监控 网络协议
SaltStack安装Apache/Mysql/PHP部署Wordpress
SaltStack是一个服务器基础架构集中化管理平台,具备配置管理、远程执行、监控等功能,基于Python语言实现,结合轻量级消息队列(ZeroMQ)与Python第三方模块(Pyzmq、PyCrypto、Pyjinjia2、python-msgpack和PyYAML等)构建。 SaltStack 采用 C/S模式,server端就是salt的master,client端就是minion,minion与master之间通过ZeroMQ消息队列通信。 master监听4505和4506端口,4505对应的是ZMQ的PUB system,用来发送消息,4506对应的是REP system是来接受
179 0
|
关系型数据库 应用服务中间件 测试技术
|
Python 消息中间件 运维