安装EPEL源:(mast和minion都需要安装)
[root@c02 src]# wget http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@c02 src]# rpm -ihv epel-release-6-8.noarch.rpm
安装rpmforge
在redhat6和centos 6的epel源上没有python-jinja2 salt-master:10.100.0.74
salt-minion:10.100.0.61 [root@salt-master ~]# yum install slat-master
[root@salt-master ~]# chkconfig salt-master on
[root@salt-master ~]# chkconfig --list|grep salt-master
salt-master 0:off 1:off 2:on 3:on 4:on 5:on 6:off salt-minion端
[root@salt-minion ~]# yum install salt-minion -y
[root@salt-minion ~]# chkconfig salt-minion on
[root@salt-minion ~]# chkconfig --list |grep salt-minion
salt-minion 0:off 1:off 2:on 3:on 4:on 5:on 6:off 查看salt-master的相关文件:
[root@salt-master ~]# rpm -ql salt-master
/etc/rc.d/init.d/salt-master
/etc/salt/master
/usr/bin/salt
/usr/bin/salt-cp
/usr/bin/salt-key
/usr/bin/salt-master
/usr/bin/salt-run
/usr/bin/salt-unity
/usr/share/man/man1/salt-cp.1.gz
/usr/share/man/man1/salt-key.1.gz
/usr/share/man/man1/salt-master.1.gz
/usr/share/man/man1/salt-run.1.gz
/usr/share/man/man1/salt-unity.1.gz
/usr/share/man/man7/salt.7.gz
配份原始配置文件:
[root@salt-master ~]# cp /etc/salt/master /etc/salt/master.bak
去掉下面几行的#
[root@salt-master ~]# egrep -v "^#|^$" /etc/salt/master
file_roots:
base:
- /srv/salt/
pillar_roots: #注意前面有个空格,不然会报错!
base:
- /srv/pillar
[root@salt-master ~]# /etc/init.d/salt-master start
Starting salt-master daemon: [ OK ] 查看salt-minion的相关文件:
[root@salt-minion ~]# rpm -ql salt-minion
/etc/rc.d/init.d/salt-minion
/etc/salt/minion
/usr/bin/salt-call
/usr/bin/salt-minion
/usr/share/man/man1/salt-call.1.gz
/usr/share/man/man1/salt-minion.1.gz 配份原始文件:
[root@salt-minion ~]# cp /etc/salt/minion /etc/salt/minion.bk
在/etc/salt/minion的16行去掉#改为master的IP或主机名
[root@salt-minion ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.100.0.74 salt-master
[root@salt-minion ~]# egrep -v "^#|^$" /etc/salt/minion
master: salt-master
[root@salt-minion ~]# /etc/init.d/salt-minion start
Starting salt-minion daemon: [ OK ] master端:
显示所有minion认证信息:
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
salt-minion
Rejected Keys:
接受salt-minion认证信息
[root@salt-master ~]# salt-key -a salt-minion
The following keys are going to be accepted:
Unaccepted Keys:
salt-minion
Proceed? [n/Y] y
Key for minion salt-minion accepted.
[root@salt-master ~]# salt-key -L
Accepted Keys:
salt-minion
Denied Keys:
Unaccepted Keys:
Rejected Keys:
#salt-key -A #接受所有Unaccepted状态的minion认证信息 拒绝认证某客户端服务器:
[root@salt-master ~]# salt-key -d salt-minion
The following keys are going to be deleted:
Accepted Keys:
salt-minion
Proceed? [N/y] y
Key for minion salt-minion deleted.
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
Rejected Keys:
拒绝所有:
[root@salt-master ~]# salt-key -D
删除某个minion认证后,后新加入进来:
1:minion端,停掉salt-minion:/etc/init.d/salt-minion stop
2:同在minion端删除/etc/salt/pki目录,重新启动salt-minion
[root@salt-minion ~]# tree /etc/salt/
/etc/salt/
├── minion
├── minion.bk
├── minion.d
│   └── _schedule.conf
├── minion_id
└── pki
└── minion
├── minion_master.pub
├── minion.pem
└── minion.pub 3 directories, 7 files
[root@salt-minion ~]# /etc/init.d/salt-minion stop
Stopping salt-minion daemon: [ OK ]
[root@salt-minion ~]# rm -rf /etc/salt/pki/
[root@salt-minion ~]# /etc/init.d/salt-minion start
Starting salt-minion daemon: [ OK ]
查看所有minion认证信息:
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
salt-minion
Rejected Keys:
#可以看到salt-minion又处于Unaccepted Keys中
[root@salt-master ~]# salt-key -a salt-minion -y
The following keys are going to be accepted:
Unaccepted Keys:
salt-minion
Key for minion salt-minion accepted.
[root@salt-master ~]# salt-key -L
Accepted Keys:
salt-minion
Denied Keys:
Unaccepted Keys:
Rejected Keys: 文件分发:
[root@salt-master salt]# salt-cp '*' /etc/hosts /
{'salt-minion': {'/hosts': True}}
#上面这种方法不见义使用
检测通讯是否正常,也可以指定其中一个:
[root@salt-master minions]# salt '*' test.ping
salt-minion:
True
DB:
True
[root@salt-master minions]# salt 'DB' test.ping
DB:
True
远程执行命令:
[root@salt-master ~]# salt "DB" cmd.run 'df -h'
DB:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
8.3G 7.7G 254M 97% /
tmpfs 939M 12K 939M 1% /dev/shm
/dev/vda1 477M 38M 414M 9% /boot
/dev/vdb1 50G 6.6G 41G 15% /data
[root@salt-master ~]# salt "*" cmd.run 'df -h'
DB:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
8.3G 7.7G 254M 97% /
tmpfs 939M 12K 939M 1% /dev/shm
/dev/vda1 477M 38M 414M 9% /boot
/dev/vdb1 50G 6.6G 41G 15% /data
salt-minion:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_c01-lv_root
8.3G 4.2G 3.8G 53% /
tmpfs 498M 12K 498M 1% /dev/shm
/dev/vda1 477M 33M 419M 8% /boot
注意这里的*必须是在master上已经被接受的客户端
Master与Minion认证 1.minion 在第一次启动时,会在/etc/salt/pki/minion/(该路径在/etc/salt/minion里面设置)下自动生成 minion.pem(private key)和minion.pub(public key),然后将minion.pub发送给master。 2.master 在接收到minion的public key后,通过salt-key命令accept minion public key,这样在master的/etc/salt/pki/master/minions下的将会存放以minion id命名的public key, 然后master就能对minion发送指令了。 Master与Minion的连接(也就是端口并防火墙的设置)
saltstack master默认监听4505和4506两个端口.其中4505(publish_port)为salt客户端与
服务端通信的端口.如果使用lsof查看4505端口持续保持在ESTABLISHED
[root@salt-master ~]# lsof -i:4505
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
salt-mast 3106 root 12u IPv4 26824 0t0 TCP *:4505 (LISTEN)
salt-mast 3106 root 14u IPv4 29676 0t0 TCP salt-master:4505->salt-minion:40948 (ESTABLISHED)
salt-mast 3106 root 15u IPv4 75603 0t0 TCP salt-master:4505->DB:46810 (ESTABLISHED) Denied Keys:
[root@salt-master ~]# salt \* test.ping
salt-minion:
True
DB:
True
DB:
True
[root@salt-master ~]# salt-key -L
Accepted Keys:
DB
salt-minion
Denied Keys:
DB
Unaccepted Keys:
#Rejected Keys: 删除/etc/salt/pki/master/minions_denied/DB就可以了如下: [root@salt-master master]# pwd
/etc/salt/pki/master
[root@salt-master master]# tree
.
├── master.pem
├── master.pub
├── minions
│   ├── DB
│   └── salt-minion
├── minions_autosign
├── minions_denied
│   └── DB
├── minions_pre
└── minions_rejected 5 directories, 5 files
[root@salt-master master]# rm minions_denied/DB
rm: remove regular file `minions_denied/DB'? y
[root@salt-master master]# tree
.
├── master.pem
├── master.pub
├── minions
│   ├── DB
│   └── salt-minion
├── minions_autosign
├── minions_denied
├── minions_pre
└── minions_rejected 5 directories, 4 files
[root@salt-master master]# salt
salt salt-cp salt-key salt-master salt-run salt-unity
[root@salt-master master]# salt-key -L
Accepted Keys:
DB
salt-minion
Denied Keys:
Unaccepted Keys:
Rejected Keys: Saltstack 防火墙配置 (1) 在主控端添加TCP 4505,TCP 4506 的规则,而在被控端无须配置防火墙,原理是被控端直接与主控端的zeromp建立链接。 接收 广播道任务信息并执行,具体操作是添加两条iptables规则: -A INPUT -m state --state new -m tcp -p tcp --dport 4505 -j ACCEPT -A INPUT -m state --state new -m tcp -p tcp --dport 4506 -j ACCEPT spacer.gif部署要求:两台机器网络互通,最好关闭防火墙。关闭selinux. 注意:一般这些端口都是监听在内网的端口,所以对于防火墙的公网的端口不需要打开

rpm_快速安装saltstake的更多相关文章

  1. CocoaPods 的简单快速安装方法

    CocoaPods 的简单快速安装方法(Setting up CocoaPods master repo 卡着不动,是因为淘宝镜像已经不能用了. 一.git clone方法安装cocoapods 镜像 ...

  2. CentOS RDO方式快速安装OpenStack

    一.了解RDO RDO是什么? RDO是红帽Red Hat Enterprise Linux OpenStack Platform的社区版,类似RHEL和Fedora,RHEV和oVirt这样的关系. ...

  3. Linux超快速安装Ruby on Rails

    Linux超快速安装Ruby on Rails 时间 2014-11-25 11:45:11 Flincllck Talk 原文  http://www.flincllck.com/quick-ins ...

  4. Python,Jupyter Notebook,IPython快速安装教程

    0.安装环境 Windows10,Python3.5.1,IPython,jupyter notebook,and other functionality 官方安装文档Linux版3.x 官方安装文档 ...

  5. 转载 - Vultr VPS注册开通且一键快速安装PPTP VPN和电脑连接使用

    本文转载来自:https://www.vultrclub.com/139.html 从2014年Vultr VPS进入市场之后,作为有背景.实力的搅局者,是的最近两年VPS.服务器的用户成本降低.配置 ...

  6. Vmware快速安装linux虚拟机(SUSE)

    安装环境:Vmware 11.SUSE11 64位 vmware快速安装linux虚拟机的过程还是比较简单的,步骤如下: 1.点击文件,新建虚拟机. 2.选择典型安装. 3.在红框中选择想要安装的虚拟 ...

  7. zabbix 3.0快速安装简介(centos 6)

    zabbix快速安装 系统版本:centos 6 1.yum源配置和zabbix.msyql安装 rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3. ...

  8. zabbix 3.0快速安装简介(centos 7)

    zabbix快速安装 系统版本:centos 7 通过yum方法安装Zabbix3.0,安装源为阿里云 yum源配置 rpm -ivh http://mirrors.aliyun.com/zabbix ...

  9. Python MySQLdb在Linux下的快速安装

    在家里windows环境下搞了一次 见   python MySQLdb在windows环境下的快速安装.问题解决方式 http://blog.csdn.NET/wklken/article/deta ...

随机推荐

  1. SpringCloud服务消费者第一次调用出现超时问题的解决方案

    在第一次访问服务消费者的时候(消费者去调用服务提供者服务)会出现如下异常: com.netflix.hystrix.exception.HystrixRuntimeException: TestSer ...

  2. 1万字!彻底看懂微信小程序

    Q:为什么说小程序如炮友? A:小程序刚发布不久就流行一个段子:APP如原配,一年不用几次:服务号如情人,一个月固定几次:订阅号如酒店小卡片,天天可以卖广告:小程序像炮友,用完就走. 资本如嫖客,各个 ...

  3. js截取相应的域名----正则匹配法 和校验Url 正则表达式

    js截取相应的域名----正则匹配法 和校验Url 正则表达式 用javascript截取相应的域名方法两种,供大家参考 1.方法1: [javascript] view plain copy fun ...

  4. 【js+jquery】通用、简单的JS 提示框

    1.该插件不需要依赖 jquery,仅仅使用了原生js 2.简单.通用.可自定义修改样式.支持等待N秒消失.支持消失后跳转其他url , 功能还是比较完善的. 3.不废话,上代码: (我存放的位置在 ...

  5. (原+转)使用anaconda遇到的问题

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/6669434.html 使用anaconda怎么感觉都是问题啊.... 1. Intel MKL FAT ...

  6. svn备份与还原_脚本_(dump命令)

    今天备份svn, 能保证好用就行先, 回头再研究 buerguo.bat @echo off :: 关闭回显 :: 说明:如有命令不明白,请使用帮助命令:命令/? .如:for/? :: 设置标题 t ...

  7. 【LeetCode】3. Longest Substring Without Repeating Characters (2 solutions)

    Longest Substring Without Repeating Characters Given a string, find the length of the longest substr ...

  8. 转载:Kafka 之 中级 原作者:悟性

    Kafka 之 中级 悟性 发表于 3年前 阅读 21353 摘要: Kafka配置介绍,原理介绍及生产者,消费者Java基本使用方法. 1.    配置 Ø  Broker主要配置 参数 默认值 说 ...

  9. 业务、架构、技术,我们应该关注什么 Java和.Net的优势劣势简单看法 市场经济决定,商业之道即是软件之道,市场的需求决定着软件技术的发展 利益决定着选择应用新技术

    业务.架构.技术,我们应该关注什么 一个企业存在的必然和前提就是获取企业生成的利润,怎么样合法合理取得利润呢,企业怎么样生存下去呢,很简单,为客户提供等值的产品与服务,客户支付你相应的报酬. 我们是从 ...

  10. windbg(1)

    1.http://www.cnblogs.com/huangyong9527/category/384128.html 2.http://www.cnblogs.com/pugang/category ...