CentOS 6.5 SaltStack安装配置

6 篇文章 0 订阅
5 篇文章 0 订阅

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值