CentOS 6.5 SaltStack安装配置

SaltStack 开源的集群管理工具,基于Python开发,开源,简单,快速,容易上手。

Master 是主管理节点; (农场主)
Minion 是具体的服务设备节点; (监工
Syndic 是一群Minion的代理管理节点;(奴隶

  1. 配置HOST
[root@23 bin]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.198.23 salt-master
192.168.198.99 salt-minion

2.通过yum安装

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

salt-master# yum install -y salt-master

salt-minion# yum -y install salt-minion

3.master 上配置防火墙

iptables -I INPUT 10 -p tcp --dport 4505:4506 -j ACCEPT

4.配置master节点

vim /etc/salt/master

# The file server works on environments passed to the master,each environment
# can have multiple root directories,the subdirectories in the multiple file
# roots cannot match,otherwise the downloaded files will not be able to be
# reliably ensured. A base environment is required to house the top file.
# Example:
# file_roots:
# base:
# - /srv/salt/
# dev:
# - /srv/salt/dev/services
# - /srv/salt/dev/states
# prod:
# - /srv/salt/prod/services
# - /srv/salt/prod/states

#
file_roots:
  base:
    - /srv/salt


# Salt Pillars allow for the building of global data that can be made selectively
# available to different minions based on minion grain filtering. The Salt
# Pillar is laid out in the same fashion as the file server,with environments,
# a top file and sls files. However,pillar data does not need to be in the
# highstate format,and is generally just key/value pairs.
pillar_roots:
  base:
    - /srv/pillar

5.配置minion节点

vim /etc/salt/minion

# Set the location of the salt master server. If the master server cannot be
# resolved,then the minion will fail to start.
master: salt-master

# 
Explicitly declare the id for this minion to use,if left commented the id
# will be the hostname as returned by the python call: socket.getfqdn()
# Since salt uses detached ids it is possible to run multiple minions on the
# same machine but with different ids,this can be useful for salt compute
# clusters.
id: salt-minion

6.启动服务

salt-master# /etc/init.d/salt-master start

salt-minion# /etc/init.d/salt-minion start

minion启动后,会向master发起认证请求,可以配置master默认接受一切认证请求,或者挨个接受。

7.接受认证

salt-master# salt-key -L  #List all public keys
Accepted Keys:
Denied Keys:
Unaccepted Keys:
salt-minion
Rejected Keys:

接受salt-minion的请求

salt-master# salt-key -a salt-minion #Accept the specified public key
The following keys are going to be accepted:
Unaccepted Keys:
salt-minion Proceed? [n/Y] y
Key for minion salt-minion accepted.
[root@23 bin]# salt-key -L
Accepted Keys:
salt-minion Denied Keys: Unaccepted Keys: Rejected Keys:

8.简单命令

# salt '*' test.ping    #检查当前所有主机状态
# salt 'salt-minion' test.ping
# salt '*' cmd.run 'df -h'

9.缺点就是太占内存了,默认启动10个进程,每个占用1g的内存

top
PID USER PR NI VIRT RES SHR S %cpu %MEM TIME+ COMMAND
31970 root 20 0 394m 34m 2916 S 0.0 0.9 5:07.42 salt-master
31977 root 20 0 1194m 33m 3008 S 0.0 0.9 0:01.13 salt-master
31974 root 20 0 1194m 33m 3008 S 0.0 0.9 0:01.13 salt-master
31976 root 20 0 1194m 33m 3004 S 0.0 0.9 0:01.15 salt-master
31982 root 20 0 1194m 33m 3008 S 0.0 0.9 0:01.13 salt-master
31975 root 20 0 1194m 33m 2996 S 0.0 0.9 0:01.13 salt-master
31972 root 20 0 370m 23m 1568 S 0.0 0.6 0:00.22 salt-master
31991 root 20 0 666m 21m 1720 S 0.0 0.6 0:00.17 salt-master
31971 root 20 0 370m 21m 1796 S 0.0 0.6 0:00.00 salt-master
31969 root 20 0 286m 21m 1320 S 0.0 0.6 0:00.01 salt-master

http://www.cnblogs.com/zzzhfo/p/5790918.html
http://www.cnblogs.com/alexyang8/p/3445333.html

相关文章

有时候CentOS工作在无互联网的环境下,需要在离线环境下安装一些组件,这次实现的是模拟在离线环境下安...
首先参照https://www.cnblogs.com/wdw984/p/13330074.html,来进行如何安装Centos和离线下载rpm包。 离...
有两个.NET CORE3.1网站部署在CentOS7上(内网IP是192.168.2.32),现在想实现访问http://192.168.2.32...
1、yum -y install vsftpd 安装vsftpd 2、配置vsftpd的配置文件(/etc/vsftpd/vsftpd.conf)主要修改以...
首先去mysql官网下载mysql的离线rpm安装包(https://downloads.mysql.com/archives/community/) Mysql...
第一步下载erlang环境并安装: wget https://packages.erlang-solutions.com/erlang/rpm/centos/7/x86_...