SaltStack本地管理无master模式-第八篇
Salt本地管理应用场景
1.在边缘节点服务器非常少没有Salt-master
2.零售店,电影院等弱网络环境没有Salt-master
3.快速部署单个服务没有Salt-master
实现
一,安装minion
[root@linux-node1 ~]# yum install -y salt-minion
二,更改minon配置文件,红色部分为新增加
[root@linux-node1 ~]# cat /etc/salt/minion
# defined below by setting it to "local". Setting a local file_client runs the
#file_client: remote #默认remote 使用的远程Master模式
file_client: local #新增加一行 使用本地模式
....
# 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/base
dev:
- /srv/salt/dev
test:
- /srv/salt/test
prod:
- /srv/salt/prod
.....
三,无需启动minion
[root@linux-node1 ~]# systemctl stop salt-minion
四,查看本地状态文件,以安装一个tomcat为列
[root@linux-node1 base]# cat /srv/salt/base/web/tomcat.sls
jdk-install:
pkg.installed:
- name: java-1.8.-openjdk tomcat-install:
file.managed:
- name: /usr/local/src/apache-tomcat-8.0..tar.gz
- source: salt://web/files/apache-tomcat-8.0.46.tar.gz
- user: root
- group: root
- mode:
cmd.run:
- name: cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat
- unless: test -L /usr/local/tomcat && test -d /usr/local/apache-tomcat-8.0.
五,salt-call测试
[root@linux-node1 ~]# salt-call --local test.ping
local:
True
六,使用salt-call执行本地状态文件
root@linux-node1 base]# salt-call --local state.sls web.tomcat
[INFO ] Loading fresh modules for state activity
[INFO ] Fetching file from saltenv 'base', ** done ** 'web/tomcat.sls'
[INFO ] Running state [java-1.8.-openjdk] at time ::34.066323
[INFO ] Executing state pkg.installed for java-1.8.-openjdk
[INFO ] Executing command ['rpm', '-qa', '--queryformat', '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)\n'] in directory '/root'
[INFO ] Executing command ['repoquery', '--plugins', '--queryformat', '%{NAME}_|-%{ARCH}', '--pkgnarrow=all', '--all'] in directory '/root'
[INFO ] Executing command ['yum', '--quiet', 'clean', 'expire-cache'] in directory '/root'
[INFO ] Executing command ['yum', '--quiet', 'check-update'] in directory '/root'
[INFO ] Executing command ['yum', '-y', 'install', 'java-1.8.0-openjdk'] in directory '/root'
[INFO ] Executing command ['rpm', '-qa', '--queryformat', '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)\n'] in directory '/root'
[INFO ] Installed Packages:
'nss-pem' changed from 'absent' to '1.0.3-4.el7'
'nss-tools' changed from '3.21.0-9.el7_2' to '3.28.4-15.el7_4'
'libXi' changed from 'absent' to '1.7.9-1.el7'
'python-javapackages' changed from 'absent' to '3.4.1-11.el7'
'xorg-x11-font-utils' changed from 'absent' to '1:7.5-20.el7'
'libXcomposite' changed from 'absent' to '0.4.4-4.1.el7'
'libICE' changed from 'absent' to '1.0.9-9.el7'
'nss-sysinit' changed from '3.21.0-9.el7_2' to '3.28.4-15.el7_4'
'copy-jdk-configs' changed from 'absent' to '2.2-3.el7'
'tzdata-java' changed from 'absent' to '2017b-1.el7'
'libXrender' changed from 'absent' to '0.9.10-1.el7'
'lksctp-tools' changed from 'absent' to '1.0.17-2.el7'
'xorg-x11-fonts-Type1' changed from 'absent' to '7.5-9.el7'
'libXfont' changed from 'absent' to '1.5.2-1.el7'
'chkconfig' changed from '1.3.61-5.el7_2.1' to '1.7.4-1.el7'
'libfontenc' changed from 'absent' to '1.1.3-3.el7'
'java-1.8.0-openjdk' changed from 'absent' to '1:1.8.0.144-0.b01.el7_4'
'python-lxml' changed from 'absent' to '3.2.1-4.el7'
'javapackages-tools' changed from 'absent' to '3.4.1-11.el7'
'java-1.8.0-openjdk-headless' changed from 'absent' to '1:1.8.0.144-0.b01.el7_4'
'nss' changed from '3.21.0-9.el7_2' to '3.28.4-15.el7_4'
'libXext' changed from 'absent' to '1.3.3-3.el7'
'nspr' changed from '4.11.0-1.el7_2' to '4.13.1-1.0.el7_3'
'nss-util' changed from '3.21.0-2.2.el7_2' to '3.28.4-3.el7'
'giflib' changed from 'absent' to '4.1.6-9.el7'
'libXtst' changed from 'absent' to '1.2.3-1.el7'
'nss-softokn' changed from '3.16.2.3-14.2.el7_2' to '3.28.3-8.el7_4'
'libSM' changed from 'absent' to '1.2.2-2.el7'
'nss-softokn-freebl' changed from '3.16.2.3-14.2.el7_2' to '3.28.3-8.el7_4'
'ttmkfdir' changed from 'absent' to '3.0.9-42.el7' [INFO ] Loading fresh modules for state activity
[INFO ] Completed state [java-1.8.-openjdk] at time ::17.648075
[INFO ] Running state [/usr/local/src/apache-tomcat-8.0..tar.gz] at time ::17.654621
[INFO ] Executing state file.managed for /usr/local/src/apache-tomcat-8.0..tar.gz
[INFO ] Fetching file from saltenv 'base', ** done ** 'web/files/apache-tomcat-8.0.46.tar.gz'
[INFO ] File changed:
New file
[INFO ] Completed state [/usr/local/src/apache-tomcat-8.0..tar.gz] at time ::17.811524
[INFO ] Running state [cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat] at time ::17.812426
[INFO ] Executing state cmd.run for cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat
[INFO ] Executing command 'test -L /usr/local/tomcat && test -d /usr/local/apache-tomcat-8.0.46' in directory '/root'
[INFO ] Executing command 'cd /usr/local/src && tar zxf apache-tomcat-8.0.46.tar.gz && mv apache-tomcat-8.0.46 /usr/local/ && ln -s /usr/local/apache-tomcat-8.0.46 /usr/local/tomcat' in directory '/root'
[INFO ] {'pid': , 'retcode': , 'stderr': '', 'stdout': ''}
[INFO ] Completed state [cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat] at time ::18.311686
local:
----------
ID: jdk-install
Function: pkg.installed
Name: java-1.8.-openjdk
Result: True
Comment: The following packages were installed/updated: java-1.8.-openjdk
Started: ::34.066323
Duration: 283581.752 ms
Changes:
----------
chkconfig:
----------
new:
1.7.-.el7
old:
1.3.-.el7_2.
copy-jdk-configs:
----------
new:
2.2-.el7
old:
giflib:
----------
new:
4.1.-.el7
old:
java-1.8.-openjdk:
----------
new:
:1.8.0.144-.b01.el7_4
old:
java-1.8.-openjdk-headless:
----------
new:
:1.8.0.144-.b01.el7_4
old:
javapackages-tools:
----------
new:
3.4.-.el7
old:
libICE:
----------
new:
1.0.-.el7
old:
libSM:
----------
new:
1.2.-.el7
old:
libXcomposite:
----------
new:
0.4.-4.1.el7
old:
libXext:
----------
new:
1.3.-.el7
old:
libXfont:
----------
new:
1.5.-.el7
old:
libXi:
----------
new:
1.7.-.el7
old:
libXrender:
----------
new:
0.9.-.el7
old:
libXtst:
----------
new:
1.2.-.el7
old:
libfontenc:
----------
new:
1.1.-.el7
old:
lksctp-tools:
----------
new:
1.0.-.el7
old:
nspr:
----------
new:
4.13.-1.0.el7_3
old:
4.11.-.el7_2
nss:
----------
new:
3.28.-.el7_4
old:
3.21.-.el7_2
nss-pem:
----------
new:
1.0.-.el7
old:
nss-softokn:
----------
new:
3.28.-.el7_4
old:
3.16.2.3-14.2.el7_2
nss-softokn-freebl:
----------
new:
3.28.-.el7_4
old:
3.16.2.3-14.2.el7_2
nss-sysinit:
----------
new:
3.28.-.el7_4
old:
3.21.-.el7_2
nss-tools:
----------
new:
3.28.-.el7_4
old:
3.21.-.el7_2
nss-util:
----------
new:
3.28.-.el7
old:
3.21.-2.2.el7_2
python-javapackages:
----------
new:
3.4.-.el7
old:
python-lxml:
----------
new:
3.2.-.el7
old:
ttmkfdir:
----------
new:
3.0.-.el7
old:
tzdata-java:
----------
new:
2017b-.el7
old:
xorg-x11-font-utils:
----------
new:
:7.5-.el7
old:
xorg-x11-fonts-Type1:
----------
new:
7.5-.el7
old:
----------
ID: tomcat-install
Function: file.managed
Name: /usr/local/src/apache-tomcat-8.0..tar.gz
Result: True
Comment: File /usr/local/src/apache-tomcat-8.0..tar.gz updated
Started: ::17.654621
Duration: 156.903 ms
Changes:
----------
diff:
New file
mode: ----------
ID: tomcat-install
Function: cmd.run
Name: cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat
Result: True
Comment: Command "cd /usr/local/src && tar zxf apache-tomcat-8.0.46.tar.gz && mv apache-tomcat-8.0.46 /usr/local/ && ln -s /usr/local/apache-tomcat-8.0.46 /usr/local/tomcat" run
Started: ::17.812426
Duration: 499.26 ms
Changes:
----------
pid: retcode: stderr:
stdout: Summary
------------
Succeeded: (changed=)
Failed:
------------
Total states run:
salt-call --local state.sls web.tomcat
总结
1.本地管理模式,无需salt-master
2.本地管理模式,不需要启动minion服务
附 赵班长的 GitHub saltbook-code网址
https://github.com/unixhot/saltbook-code/tree/master
SaltStack本地管理无master模式-第八篇的更多相关文章
- Saltstack实战之无master和多master
如果不想依赖master可以设置为无master vim /etc/salt/minion 就可以通过minion来安装一个salt-master了(下来查资料做,关闭salt-minion进程因为不 ...
- Saltstack_使用指南14_无master
1. 主机规划 salt 版本 [root@salt100 ~]# salt --version salt (Oxygen) [root@salt100 ~]# salt-minion --versi ...
- SaltStack之无Master和多Master(九)
SaltStack之无Master和多Master Masterless架构,无Master 实现方式: 1)关闭minion进程 2)修改配置文件 vi /etc/salt/minion file_ ...
- Spring Cloud实战 | 最八篇:Spring Cloud +Spring Security OAuth2+ Axios前后端分离模式下无感刷新实现JWT续期
一. 前言 记得上一篇Spring Cloud的文章关于如何使JWT失效进行了理论结合代码实践的说明,想当然的以为那篇会是基于Spring Cloud统一认证架构系列的最终篇.但关于JWT另外还有一个 ...
- 2.配置通过数据库接收SaltStack批量管理日志
2.配置通过数据库接收SaltStack批量管理日志 2016-07-04 10:02:52来源:oschina作者:eddy_linux人点击 默认情况下发送给salt minion的命令执 ...
- RocketMQ环境搭建(双master模式)
介绍: 多Master模式,一个集群无Slave,全是Master,例如2个Master或者3个Master. 优点:配置简单,单个Master宕机或重启维护对应用无影响,在磁盘配置为RAID10时, ...
- 学习笔记37—WIN7系统本地连接没有有效的IP地址 电脑本地连接无有效ip配置怎么办
WIN7系统本地连接没有有效的IP地址 电脑本地连接无有效ip配置怎么办 家中有两台笔记本都有无线网卡,现在想让两台笔记本都能够上网,而又不想购买路由器,交换机等设备,这个时候怎么办呢? 其实只要进行 ...
- RockerMQ介绍 及搭建双master模式
一.RocketMQ介绍 1.1 简介 RocketMQ 是一款分布式.队列模型的消息中间件,具有以下特点: 能够保证严格的消息顺序 提供丰富的消息拉取模式 高效的订阅者水平扩展能力 实时的消息订阅机 ...
- 本地管理表空间和字典管理表空间的特点,ASSM有什么特点
字典管理表空间(Dictionary-Managed Tablespace简称DMT),8i以前包括以后都还可以使用的一种表空间管理模式,通过数据字典管理表空间的空间使用. Oracle使用两个字典来 ...
随机推荐
- python egg包免安装直接使用
import sys egg_path='egg.egg' sys.path.append(egg_path) import egg_sample
- FW:主流RPC框架
主流RPC框架 2015年10月27日 zman RPC 介绍目前在互联网公司比较流行的开源的RPC框架. RPC框架比较 语言 协议 服务治理 社区 机构 Hessian 多语言 he ...
- java generic super, extend
//Apple Orange 都继承自Fruit类,同时Jonathan是Apple的子类 List<? extends Fruit> list = new ArrayList< ...
- React实例入门教程(1)基础API,JSX语法--hello world
前 言 毫无疑问,react是目前最最热门的框架(没有之一),了解并学习使用React,可以说是现在每个前端工程师都需要的. 在前端领域,一个框架为何会如此之火爆,无外乎两个原因:性能优秀,开发 ...
- 【转】spring boot application.properties 配置参数详情
multipart multipart.enabled 开启上传支持(默认:true) multipart.file-size-threshold: 大于该值的文件会被写到磁盘上 multipart. ...
- HDFS基本命令行操作及上传文件的简单API
一.HDFS基本命令行操作: 1.HDFS集群修改SecondaryNameNode位置到hd09-2 (1)修改hdfs-site.xml <configuration> //配置元数据 ...
- Web性能测试通用标准
性能指标 通过 不通过 备注 响应时间 <期望时间 >期望时间 1.所有性能指标期望值是根据性能测试申请单取值: 2.响应时间2-5-8原则: 响应时间在2-5秒内,系统的响应速度比较快: ...
- git学习——<二>git配置文件
一.git所有配置文件 <一>./etc/gitconfig全局配置文件 修改该配置文件,会对所有用户有影响. 使用git config --system来配置该文件 <二>. ...
- ambari rest api (三)
1.获取指定主机指定组件的信息列表 http://ip:8080/api/v1/clusters/hdp_dev/hosts/hadoop003.edcs.org/host_components/DA ...
- python全栈开发从入门到放弃之常用模块和正则
什么是模块? 常见的场景:一个模块就是一个包含了python定义和声明的文件,文件名就是模块名字加上.py的后缀. 但其实import加载的模块分为四个通用类别: 1 使用python编写的代码(.p ...