saltstack安装部署以及简单实用
一,saltstack简介:
SaltStack是一种新的基础设施管理方法开发软件,简单易部署,可伸缩的足以管理成千上万的服务器,和足够快的速度控制,与他们交流,以毫秒为单位。
SaltStack提供了一个动态基础设施通信总线用于编排,远程执行、配置管理等等。SaltStack基于python开发,项目于2011年启动,年增长速度较快,五年期
固定基础设施编制和配置管理的开源项目。SaltStack社区致力于保持盐项目集中、友好、健康、开放。
(网上摘抄的,说白了saltStack就是一个自动化工具,可以实现对服务器的批量操作)
二、安装环境
saltstack支持大部分UNIX/Linux及Windows环境。本次安装的环境采用centos6
host A:192.168.163.229:master
host B:192.168.163.152:slaver
三,安装
host A:
[root@master ~]# yum install salt-master [root@master ~]# yum install salt-minion
host B:
[root@slave ~]# yum install salt-minion
如果发现yum 源没有这个包,则需要配置yum 源。
[saltstack-repo]
name=SaltStack repo for RHEL/CentOS $releasever
baseurl=https://repo.saltstack.com/yum/redhat/$releasever/$basearch/2016.11
enabled=
gpgcheck=
gpgkey=https://repo.saltstack.com/yum/redhat/$releasever/$basearch/2016.11/SALTSTACK-GPG-KEY.pub
至此,master和slaver安装完成(因为是测试,所以只安装了2台slaver,正式环境,每天机器都需要安装slaver)
四、master和slaver配置
master配置文件路径:/etc/salt/master
vim /etc/salt/master #修改第16行
interface: 192.168.163.229
注意interface:后面有一个空格,后面再跟本机(master)的ip地址即可。保存文件,启动master。
[root@master ~]# /etc/init.d/salt-master start
Starting salt-master daemon: [确定]
[root@master ~]#
用ps命令查看进程,可以看到master启动成功
[root@master ~]# ps -ef| grep salt
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : pts/ :: grep salt
修改slaver配置:
[root@master ~]# vim /etc/salt/minion #default_include: minion.d/*.conf
13
14 # Set the location of the salt master server. If the master server cannot be
15 # resolved, then the minion will fail to start.
16 #master: salt
17 master: 192.168.163.229
18
19 # If multiple masters are specified in the 'master' setting, the default behavior
20 # is to always try to connect to them in the order they are listed. If random_master is
21 # set to True, the order will be randomized instead. This can be helpful in distributing
22 # the load of many minions executing salt-call requests, for example, from a cron job.
23 # If only one master is listed, this setting is ignored and a warning will be logged.
24 # NOTE: If master_type is set to failover, use master_shuffle instead.
25 #random_master: False
26
27 # Use if master_type is set to failover.
28 #master_shuffle: False
29
30 # Minions can connect to multiple masters simultaneously (all masters
31 # are "hot"), or can be configured to failover if a master becomes
32 # unavailable. Multiple hot masters are configured by setting this
33 # value to "str". Failover masters can be requested by setting
34 # to "failover". MAKE SURE TO SET master_alive_interval if you are
35 # using failover.
36 # master_type: str
37
38 # Poll interval in seconds for checking if the master is still there. Only
39 # respected if master_type above is "failover". To disable the interval entirely,
40 # set the value to -1. (This may be necessary on machines which have high number
修改这个文件的第16行为 master: 192.168.163.229 。同样的master:后面有一个空格,后面的ip地址即为master的ip地址,这个很好理解。
修改id为 id: 192.168.163.229 。(在文件的第78行左右)
# same machine but with different ids, this can be useful for salt compute
# clusters.
id: 192.168.163.229 # Append a domain to a hostname in the event that it does not exist. This is
# useful for systems where socket.getfqdn() does not actually result in a
# FQDN (for instance, Solaris).
#append_domain:
id即是slaver的"身份证" ,可以自定义,也可以使用ip地址,但需要全局唯一。
保存文件后,启动slaver进程。
[root@master ~]# /etc/init.d/salt-minion start
Starting salt-minion daemon: [确定]
[root@master ~]#
[root@master ~]#
[root@master ~]# ps -ef |grep salt
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-master -d
root : ? :: /usr/bin/python2. /usr/bin/salt-minion -d
root : pts/ :: grep salt
另一台host 只安装了slaver,因此只需要配置和启动slaver即可,方法和前面一样。
五,认证
master和slaver启动后,用命令salt-key查看
[root@master ~]# salt-key
Accepted Keys:
Denied Keys:
Unaccepted Keys:
192.168.163.152
192.168.163.229
Rejected Keys:
[root@master ~]#
[root@master ~]#
[root@master ~]#
[root@master ~]#
可以发现 Accepted Keys里面没有内容,Unaccpted Keys 里面有两条记录。刚好就是我们两台slaver,因为现在还没有认证过,所以需要先认证,才会变成Accepted状态。
[root@master minion]# salt-key -a 192.168.163.152
The following keys are going to be accepted:
Unaccepted Keys:
192.168.163.152
Proceed? [n/Y] Y
Key for minion 192.168.163.152 accepted.
[root@master minion]#
[root@master minion]# salt-key -a 192.168.163.229
The following keys are going to be accepted:
Unaccepted Keys:
192.168.163.229
Proceed? [n/Y] Y
Key for minion 192.168.163.229 accepted.
[root@master minion]#
[root@master minion]#
[root@master minion]#
[root@master minion]# salt-key
Accepted Keys:
192.168.163.152
192.168.163.229
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@master minion]#
到此完成了认证。
六,简单的salt命令
查看远程主机ip地址
root@master minion]# salt '192.168.163.152' cmd.run 'ifconfig'
192.168.163.152:
eth1 Link encap:Ethernet HWaddr :0C:::1E:A6
inet addr:192.168.163.152 Bcast:192.168.163.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe70:1ea6/ Scope:Link
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (45.0 MiB) TX bytes: (824.9 KiB) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::/ Scope:Host
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (11.3 KiB) TX bytes: (11.3 KiB) virbr0 Link encap:Ethernet HWaddr :::CA:B4:D1
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 b) TX bytes: (0.0 b)
[root@master minion]#
查看远程主机连通性
[root@master minion]# salt '192.168.163.152' test.ping
192.168.163.152:
True
[root@master minion]#
好了,本次安装部署介绍完毕,其他salt命令以后再详细介绍。
saltstack安装部署以及简单实用的更多相关文章
- SaltStack安装部署
SaltStack安装部署 安装: 一. master: 1. 配置yum源安装 # rpm --import https://repo.saltstack.com/yum/redhat/6/x86_ ...
- saltStack 安装部署
1.saltStack 服务架构介绍 SaltStack 是一种基于C/S架构的服务模式,在SaltStack架构中服务器端叫作Master,客户端叫作Minion,传统C/S架构为:客户端发送请求给 ...
- dubbo-admin管理控制台的安装部署(最简单)
Dubbo-admin最简单的安装部署,十分钟就能搞定! 网上找的安装教程虽说详细,但是就是因为详细操作起来而显得繁琐.今天,我帮大家跳过这些繁琐的步骤,简单快捷的安装部署dubbo-admin. 1 ...
- 02_ Flume的安装部署及其简单使用
一.Flume的安装部署: Flume的安装非常简单,只需要解压即可,当然,前提是已有hadoop环境 安装包的下载地址为:http://www-us.apache.org/dist/flume/1. ...
- elasticsearch kibana的安装部署与简单使用(一)
1.先说说es 我早两年使用过es5.x的版本,记得当时部署还是很麻烦,因为es是java写的,要先在机器上部署java环境jvm之类的一堆东西,然后才能安装es 但是现在我使用的是目前最新的7.6版 ...
- ansible的安装部署及简单应用
Ansible 是一个配置管理和应用部署工具,功能类似于目前业界的配置管理工具 Chef,Puppet,Saltstack.Ansible 是通过 Python 语言开发.Ansible 平台由 Mi ...
- 超详细saltstack安装部署及应用
1.环境准备 准备两台虚拟机 主机名 ip role linux-node1 10.0.0.7 master linux-node2 10.0.0.8 minion 在节点1上安装 master 和 ...
- libcurl安装使用方法-简单实用(摘录)
http://curl.haxx.se/libcurl/c/example.html 官网c例子http://curl.haxx.se/download/curl-7.21.3.tar.gz 下载地址 ...
- HBase的安装部署以及简单使用
一:下载安装 1.下载安装 2.开启hadoop与zookeeper 3.修改配置文件hbase-env export JAVA_HOME=/opt/modules/jdk1.7.0_67 expor ...
随机推荐
- (NO.00005)iOS实现炸弹人游戏(一):游戏的整体规划设计
在这新的系列中,我们来尝试完成一款经典的游戏:炸弹人 这是以前红白机上的炸弹人,由于游戏可玩性强,玩法又简单,在后面的机型上陆续推出了很多款续作. 在随后的触屏设备上也出现了炸弹人的模拟版,用的是模拟 ...
- 使用FMDB多线程访问数据库,及database is locked的问题
每日更新关注:http://weibo.com/hanjunqiang 新浪微博 今天终于解决了多线程同时访问数据库时,报数据库锁定的问题,错误信息是: Unknown error finalizi ...
- 【一天一道LeetCode】#116. Populating Next Right Pointers in Each Node
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 来源:http ...
- 刀片服务器和磁盘阵列卡(RAID)技术---永和维护
近期客户需要更换服务器,客户把买好的服务器送来了,原本感觉很小的一个服务器,可当我看到的时候是一个大个的又长又宽,类似机房服务器的那种,后来米老师给大致讲解一番:这个是刀片服务器. 刀片服务器是指在标 ...
- UNIX环境高级编程——信号说明列表
$ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGK ...
- MO_GLOBAL - EBS R12 中 Multi Org 设计的深入研究 (2)
这是多组织访问的第二篇文章,翻译自Anil Passi的Multi Org R12 我们都知道,在Oracle Release 12中多组织模型(Multi Org)会被改变, 它被叫作多组织访问控制 ...
- javascript setinterval 正确的语法
前几天我用setinterval 写了一个小程序,这个setinterval是用来干什么的我就不解释了. 写的方法在其它的浏览器里都能用,后来测试组的同事拿去一测就出了问题.因为她们爱用360,还有I ...
- java Domj4读取xml文件加强训练案例
需求:给出一段xml文件.要求按照鸳鸯输出. xml文件代码如下: <?xml version="1.0" encoding="utf-8"?> & ...
- Leetcode_112_Path Sum
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41910495 Given a binary tree an ...
- 网易内推(Android) 拿offer
学校BBS上师兄发网易内推,凑下热闹投了一发 一面:电话面 大概25分钟,感觉面试官气场很足,主要关注了其中一个 个人开源项目 1.自我介绍 2.说说你做的这个项目 当时谈到使用到了开源框架xtuil ...