初探SaltStack

2,430次阅读
没有评论

 

初探SaltStack

SaltStack是基于Python开发的一套C/S架构配置管理工具,他的底层使用ZeroMQ消息队列pub/sub方式通信,使用SSL证书签发的方式进行认证管理;

Python客户端接口

为了允许简单的扩展,Salt执行程序可以写为纯Python模块。数据从Salt执行过程中收集到可以发送回master服务端,或者发送到任何任意程序。Salt可以从一个简单的Python API调用,或者从命令行被调用,所以Salt可以用来执行一次性命令,也可以作为一个更大的应用程序的一个组成部分。

特点

  1. SaltStack是用Python语言开发的(模块可以自定义开发)

三种运行模式

  1. Local(本地)
  2. Master(主节点)/Minion(奴隶)
  3. Salt SSH(Web SSH)

三大功能

  1. 远程执行(多台机器批量执行)
  2. 配置管理(状态管理)
  3. 云管理(支持阿里云,AWS等)

基本原理

SaltStack 采用 C/S模式,server端就是salt的master,client端就是minion,minion与master之间通过ZeroMQ消息队列通信

minion上线后先与master端联系,把自己的pub key发过去,这时master端通过salt-key -L命令就会看到minion的key,接受该minion-key后,也就是master与minion已经互信

master可以发送任何指令让minion执行了,salt有很多可执行模块,比如说cmd模块,在安装minion的时候已经自带了,它们通常位于你的python库中,locate salt | grep /usr/ 可以看到salt自带的所有东西。

这些模块是python写成的文件,里面会有好多函数,如cmd.run,当我们执行salt ‘*‘ cmd.run ‘uptime’的时候,master下发任务匹配到的minion上去,minion执行模块函数,并返回结果。master监听4505和4506端口,4505对应的是ZMQ的PUB system,用来发送消息,4506对应的是REP system是来接受消息的。

测试环境

所有主机的SElinuxfirewall均已关闭,系统采用的是CentOS 7.2

主机分布

IP 主机名 角色
192.168.56.11 linux-node1.example.com SaltStack master
192.168.56.12 linux-node2.example.com SaltStack minion

系统环境

<span class="line">1</span>
<span class="line">2</span>
<span class="line">3</span>
<span class="line">4</span>
<span class="line">5</span>
<span class="line">6</span>
<span class="line">7</span>
<span class="line">8</span>
<span class="line">9</span>
<span class="line">[root@linux-node1 ~]<span class="comment"># cat /etc/hosts</span></span>
<span class="line">127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4</span>
<span class="line">::1         localhost localhost.localdomain localhost6 localhost6.localdomain6</span>
<span class="line">192.168.56.11 linux-node1 linux-node1.example.com</span>
<span class="line">192.168.56.12 linux-node2 linux-node2.example.com</span>
<span class="line">[root@linux-node1 ~]<span class="comment"># cat /etc/redhat-release</span></span>
<span class="line">CentOS Linux release 7.2.1511 (Core)</span>
<span class="line">[root@linux-node1 ~]<span class="comment"># uname -a</span></span>
<span class="line">Linux linux-node1.example.com 3.10.0-327.22.2.el7.x86_64 <span class="comment">#1 SMP Thu Jun 23 17:05:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux</span></span>

安装SaltStack Master/Minion

  • 配置SaltStack的yum源

SaltStack官方提供了自己的yum源,地址: https://repo.saltstack.com/

MasterMinion两台机器都执行

<span class="line">1</span>
<span class="line">yum -y install https://repo.saltstack.com/yum/redhat/salt-repo-latest-1.el7.noarch.rpm</span>
  • 安装salt-master并设置开机自启动
<span class="line">1</span>
2
3
<span class="line">[root@linux-node1 ~]<span class="comment"># yum -y install salt-master</span></span>
<span class="line">[root@linux-node1 ~]<span class="comment"># systemctl enable salt-master</span></span>
<span class="line">Created symlink from /etc/systemd/system/multi-user.target.wants/salt-master.service to /usr/lib/systemd/system/salt-master.service.</span>
  • 安装salt-minion并设置开机自启动
<span class="line">1</span>
2
3
<span class="line">[root@linux-node2 ~]<span class="comment"># yum -y install salt-minion</span></span>
<span class="line">[root@linux-node2 ~]<span class="comment"># systemctl enable salt-minion</span></span>
<span class="line">Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /usr/lib/systemd/system/salt-minion.service.</span>

配置SaltStack Master/Minion

  • 启动Master

SaltStack Master默认不需要做任何配置就可以启动,后续的文章当中会对Master进行一些配置.

<span class="line">1</span>
2
3
<span class="line">[root@linux-node1 ~]<span class="comment"># systemctl start salt-master   </span></span>
<span class="line">[root@linux-node1 ~]<span class="comment"># netstat -tlnp | grep "4505"</span></span>
<span class="line">tcp        0      0 0.0.0.0:4505            0.0.0.0:*               LISTEN      1569/python</span>
  • 配置Minion

Minion需要指定Master的IP地址或者主机名

<span class="line">1</span>
2
<span class="line">[root@linux-node2 ~]<span class="comment"># vim /etc/salt/minion</span></span>
<span class="line"> 16 master: 192.168.56.11  <span class="comment"># 修改成Master的IP地址或者主机名</span></span>
  • 启动Minion
<span class="line">1</span>
2
3
4
5
<span class="line">[root@linux-node2 ~]<span class="comment"># systemctl start salt-minion</span></span>
<span class="line">[root@linux-node2 ~]<span class="comment"># ps -ef | grep "minion" | grep -v "grep"</span></span>
<span class="line">root       1547      1  0 18:49 ?        00:00:00 /usr/bin/python /usr/bin/salt-minion</span>
<span class="line">root       1552   1547  2 18:49 ?        00:00:00 /usr/bin/python /usr/bin/salt-minion</span>
<span class="line">root       1556   1552  0 18:49 ?        00:00:00 /usr/bin/python /usr/bin/salt-minion</span>

Master认证管理Minion

所有的salt-minion都需要得到salt-master的认证才可以进行管理,minion只要在配置文件中指定了master的IP地址,那么在启动minion的时候就会向master发起请求,master会进行请求的审批,是否管理Minion.

  • Minion秘钥

minion在启动的时候会在/etc/salt/pki/minion/目录下生成公钥与私钥,并且把公钥minion.pub发送个Master,如果master同意,那么master就可以管理这台minion了.

<span class="line">1</span>
2
<span class="line">[root@linux-node2 ~]<span class="comment"># ls /etc/salt/pki/minion/</span></span>
<span class="line">minion.pem  minion.pub</span>
  • Master秘钥

master秘钥存放目录/etc/salt/pki/master/

<span class="line">1</span>
<span class="line">2</span>
<span class="line">3</span>
<span class="line">4</span>
<span class="line">5</span>
<span class="line">6</span>
<span class="line">7</span>
<span class="line">8</span>
<span class="line">9</span>
10
11
12
<span class="line">[root@linux-node1 ~]<span class="comment"># tree /etc/salt/pki/master/</span></span>
<span class="line">/etc/salt/pki/master/</span>
<span class="line">├── master.pem</span>
<span class="line">├── master.pub</span>
<span class="line">├── minions   <span class="comment"># 已经同意的minion公钥存放在此目录</span></span>
<span class="line">├── minions_autosign</span>
<span class="line">├── minions_denied</span>
<span class="line">├── minions_pre    <span class="comment"># 等待同意的minion公钥存放在此目录,名字以minion配置文件中的ID命名</span></span>
<span class="line">│   └── linux-node2.example.com   <span class="comment"># 待认证的minion ID名称</span></span>
<span class="line">└── minions_rejected</span>

<span class="line">5 directories, 3 files</span>
  • Master审批Minion
<span class="line">1</span>
2
3
4
5
6
<span class="line">[root@linux-node1 ~]<span class="comment"># salt-key</span></span>
<span class="line">Accepted Keys:  <span class="comment"># 已同意的key</span></span>
<span class="line">Denied Keys:  <span class="comment"># 拒绝的key</span></span>
<span class="line">Unaccepted Keys:  <span class="comment"># 未同意的key</span></span>
<span class="line">linux-node2.example.com</span>
<span class="line">Rejected Keys:</span>

命令参数

参数 说明
-A 同意所有主机
-a 同意某个主机,支持正则
-D 删除所有主机
-d 删除某个主机,支持正则
-R 拒绝所有主机
-r 拒绝某个主机,支持正则
-F 显示所有等待认证的主机key信息
-f 显示指定等待认证的主机key信息,支持正则
-L 列出所有的主机

同意指定主机

<span class="line">1</span>
2
3
4
5
6
<span class="line">[root@linux-node1 ~]<span class="comment"># salt-key -a linux-node2.example.com</span></span>
<span class="line">The following keys are going to be accepted:</span>
<span class="line">Unaccepted Keys:</span>
<span class="line">linux-node2.example.com</span>
<span class="line">Proceed? [n/Y] Y</span>
<span class="line">Key <span class="keyword">for</span> minion linux-node2.example.com accepted.</span>

更多的用法请help

<span class="line">1</span>
<span class="line">[root@linux-node1 ~]<span class="comment"># salt-key --help</span></span>

同意之后Master会把自己的公钥发送给Minion,并存放在/etc/salt/pki/minion/目录下

<span class="line">1</span>
2
<span class="line">[root@linux-node2 ~]<span class="comment"># ls /etc/salt/pki/minion/</span></span>
<span class="line">minion_master.pub  minion.pem  minion.pub</span>

Master/Minion秘钥存放目录

  • master 秘钥对默认存储在/etc/salt/pki/master/master.pub /etc/salt/pki/master/master.pem
  • master 端认证的公钥存储在:/etc/salt/pki/master/minions/
  • minion 秘钥对默认存储在:/etc/salt/pki/minion/minion.pub /etc/salt/pki/minion/minion.pem
  • minion 存放的master公钥:/etc/salt/pki/minion/minion_master.pub
  • minion_id 默认存储在:/etc/salt/minion_id

salt常用命令

  • salt 该命令执行salt的执行模块,通常在master端运行,也是我们最常用到的命令
<span class="line">1</span>
2
<span class="line">salt [options] <span class="string">'<target>'</span> <<span class="keyword">function</span>> [arguments]</span>
<span class="line"><span class="comment"># 如: salt '*' test.ping</span></span>
  • salt-run该命令执行runner(salt带的或者自定义的,runner以后会讲),通常在master端执行,比如经常用到的manage
<span class="line">1</span>
2
3
4
<span class="line">salt-run [options] [runner.func]</span>
<span class="line">salt-run manage.status   <span class="comment"># 查看所有minion状态</span></span>
<span class="line">salt-run manage.down     <span class="comment"># 查看所有没在线minion</span></span>
<span class="line">salt-run manged.up       <span class="comment"># 查看所有在线minion</span></span>
  • salt-key密钥管理,通常在master端执行
<span class="line">1</span>
2
3
4
5
6
<span class="line">salt-key [options]</span>
<span class="line">salt-key -L              <span class="comment"># 查看所有minion-key</span></span>
<span class="line">salt-key <span class="_">-a</span> <key-name>   <span class="comment"># 接受某个minion-key</span></span>
<span class="line">salt-key <span class="_">-d</span> <key-name>   <span class="comment"># 删除某个minion-key</span></span>
<span class="line">salt-key -A              <span class="comment"># 接受所有的minion-key</span></span>
<span class="line">salt-key -D              <span class="comment"># 删除所有的minion-key</span></span>
  • salt-call 该命令通常在minion上执行,minion自己执行可执行模块,不是通过master下发job
<span class="line">1</span>
2
3
<span class="line">salt-call [options] <<span class="keyword">function</span>> [arguments]</span>
<span class="line">salt-call test.ping           <span class="comment">##自己执行test.ping命令</span></span>
<span class="line">salt-call cmd.run <span class="string">'ifconfig'</span>  <span class="comment">##自己执行cmd.run函数</span></span>
  • salt-cp 分发文件到minion上,不支持目录分发,通常在master运行
<span class="line">1</span>
<span class="line">salt-cp [options] <span class="string">'<target>'</span> SOURCE DEST</span>

把master的文件/tmp/yum.log拷贝到minion的/tmp/

<span class="line">1</span>
2
3
4
5
<span class="line">[root@linux-node1 ~]<span class="comment"># salt-cp '*' /tmp/yum.log /tmp/</span></span>
<span class="line">linux-node2.example.com:</span>
<span class="line">    ----------</span>
<span class="line">    /tmp/yum.log:</span>
<span class="line">        True</span>

远程执行

远程执行相对来说比较简单,其实就是通过salt-master的模块让minion执行某个方法或者指定的shell命令

  • 检测在线的Minion
<span class="line">1</span>
2
3
<span class="line">[root@linux-node1 ~]<span class="comment"># salt '*' test.ping</span></span>
<span class="line">linux-node2.example.com:</span>
<span class="line">    True</span>

指令说明

参数 描述
salt salt命令
‘*’ minion主机,同样支持正则
test 模块
ping 模块中的某个方法

minion执行一个w命令

<span class="line">1</span>
2
3
4
<span class="line">[root@linux-node1 ~]<span class="comment"># salt 'linux-node2.example.com' cmd.run 'w'  </span></span>
<span class="line">linux-node2.example.com:</span>
<span class="line">     19:13:29 up 37 min,  0 users,  load average: 0.00, 0.01, 0.05</span>
<span class="line">    USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT</span>

状态(配置)管理

saltstack配置管理的sls包括saltstack的配置文件都是用YAML语法格式.

<span class="line">1</span>
<span class="line">2</span>
<span class="line">3</span>
<span class="line">4</span>
<span class="line">5</span>
<span class="line">6</span>
<span class="line">7</span>
<span class="line">8</span>
<span class="line">9</span>
10
11
12
13
14
15
<span class="line">[root@linux-node1 ~]<span class="comment"># vim /etc/salt/master</span></span>
<span class="line">452 <span class="comment"># Example:</span></span>
<span class="line">453 <span class="comment"># file_roots:</span></span>
<span class="line">454 <span class="comment">#   base:</span></span>
<span class="line">455 <span class="comment">#     - /srv/salt/</span></span>
<span class="line">456 <span class="comment">#   dev:</span></span>
<span class="line">457 <span class="comment">#     - /srv/salt/dev/services</span></span>
<span class="line">458 <span class="comment">#     - /srv/salt/dev/states</span></span>
<span class="line">459 <span class="comment">#   prod:</span></span>
<span class="line">460 <span class="comment">#     - /srv/salt/prod/services</span></span>
<span class="line">461 <span class="comment">#     - /srv/salt/prod/states</span></span>
<span class="line">462 <span class="comment">#</span></span>
<span class="line">463 file_roots:</span>
<span class="line">464   base:  <span class="comment"># 环境,默认必须要有base环境</span></span>
<span class="line">465     - /srv/salt  <span class="comment"># 文件存放目录</span></span>

创建/srv/salt目录

<span class="line">1</span>
<span class="line">[root@linux-node1 ~]<span class="comment"># mkdir /srv/salt</span></span>

重启salt-master

<span class="line">1</span>
<span class="line">[root@linux-node1 ~]<span class="comment"># systemctl restart salt-master</span></span>
  • 写一个安装并启动apache的状态配置
<span class="line">1</span>
<span class="line">2</span>
<span class="line">3</span>
<span class="line">4</span>
<span class="line">5</span>
<span class="line">6</span>
<span class="line">7</span>
<span class="line">8</span>
<span class="line">9</span>
10
11
12
<span class="line">[root@linux-node1 ~]<span class="comment"># vim /srv/salt/apache.sls</span></span>
<span class="line">apache-install: <span class="comment"># 名称</span></span>
<span class="line">  pkg.installed: <span class="comment"># pkg=模块,installed=方法</span></span>
<span class="line">    - names:  <span class="comment"># 安装软件的列表,CentOS使用yum安装,Ubuntu使用apt-get安装,</span></span>
<span class="line">      - httpd  <span class="comment"># 软件包1</span></span>
<span class="line">      - httpd-tools  <span class="comment"># 软件包2</span></span>

<span class="line">apache-service:</span>
<span class="line">  service.running:</span>
<span class="line">    - name: httpd   <span class="comment"># 服务</span></span>
<span class="line">    - <span class="built_in">enable</span>: True  <span class="comment"># 开机自启动</span></span>
<span class="line">    - reload: True</span>
  • 检查minion是否安装apache
<span class="line">1</span>
2
<span class="line">[root@linux-node2 ~]<span class="comment"># rpm -qa httpd httpd-tools</span></span>
<span class="line">[root@linux-node2 ~]<span class="comment"># lsof -i :80</span></span>
  • 安装apache
<span class="line">1</span>
<span class="line">2</span>
<span class="line">3</span>
<span class="line">4</span>
<span class="line">5</span>
<span class="line">6</span>
<span class="line">7</span>
<span class="line">8</span>
<span class="line">9</span>
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<span class="line">[root@linux-node1 ~]<span class="comment"># salt 'linux-node2.example.com' state.sls apache</span></span>
<span class="line">linux-node2.example.com:</span>
<span class="line">----------</span>
<span class="line">          ID: apache-install</span>
<span class="line">    Function: pkg.installed</span>
<span class="line">        Name: httpd</span>
<span class="line">      Result: True</span>
<span class="line">     Comment: The following packages were installed/updated: httpd</span>
<span class="line">     Started: 19:57:10.727251</span>
<span class="line">    Duration: 16091.461 ms</span>
<span class="line">     Changes:   </span>
<span class="line">              ----------</span>
<span class="line">              httpd:</span>
<span class="line">                  ----------</span>
<span class="line">                  new:</span>
<span class="line">                      2.4.6-40.el7.centos.1</span>
<span class="line">                  old:</span>
<span class="line">              httpd-tools:</span>
<span class="line">                  ----------</span>
<span class="line">                  new:</span>
<span class="line">                      2.4.6-40.el7.centos.1</span>
<span class="line">                  old:</span>
<span class="line">              mailcap:</span>
<span class="line">                  ----------</span>
<span class="line">                  new:</span>
<span class="line">                      2.1.41-2.el7</span>
<span class="line">                  old:</span>
<span class="line">----------</span>
<span class="line">          ID: apache-install</span>
<span class="line">    Function: pkg.installed</span>
<span class="line">        Name: httpd-tools</span>
<span class="line">      Result: True</span>
<span class="line">     Comment: Package httpd-tools is already installed</span>
<span class="line">     Started: 19:57:26.824291</span>
<span class="line">    Duration: 0.862 ms</span>
<span class="line">     Changes:   </span>
<span class="line">----------</span>
<span class="line">          ID: apache-service</span>
<span class="line">    Function: service.running</span>
<span class="line">        Name: httpd</span>
<span class="line">      Result: True</span>
<span class="line">     Comment: Service httpd has been enabled, and is running</span>
<span class="line">     Started: 19:57:26.892530</span>
<span class="line">    Duration: 169.878 ms</span>
<span class="line">     Changes:   </span>
<span class="line">              ----------</span>
<span class="line">              httpd:</span>
<span class="line">                  True</span>

<span class="line">Summary <span class="keyword">for</span> linux-node2.example.com</span>
<span class="line">------------</span>
<span class="line">Succeeded: 3 (changed=2)</span>
<span class="line">Failed:    0</span>
<span class="line">------------</span>
<span class="line">Total states run:     3</span>

linux-node2正在用python执行yum安装软件包

<span class="line">1</span>
2
3
<span class="line">[root@linux-node2 ~]<span class="comment"># ps -ef | grep "yum"</span></span>
<span class="line">root      15527  15517 12 03:49 ?        00:00:01 /usr/bin/python /usr/bin/yum -y install httpd</span>
<span class="line">root      15540   1422  0 03:50 pts/0    00:00:00 grep --color=auto yum</span>
  • 查看执行过后的状态
<span class="line">1</span>
<span class="line">2</span>
<span class="line">3</span>
<span class="line">4</span>
<span class="line">5</span>
<span class="line">6</span>
<span class="line">7</span>
<span class="line">8</span>
<span class="line">9</span>
10
11
<span class="line">[root@linux-node2 ~]<span class="comment"># rpm -qa httpd httpd-tools</span></span>
<span class="line">httpd-2.4.6-40.el7.centos.1.x86_64</span>
<span class="line">httpd-tools-2.4.6-40.el7.centos.1.x86_64</span>
<span class="line">[root@linux-node2 ~]<span class="comment"># lsof -i :80</span></span>
<span class="line">COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME</span>
<span class="line">httpd   16166   root    4u  IPv6  37219      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16167 apache    4u  IPv6  37219      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16168 apache    4u  IPv6  37219      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16169 apache    4u  IPv6  37219      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16171 apache    4u  IPv6  37219      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16172 apache    4u  IPv6  37219      0t0  TCP *:http (LISTEN)</span>

top.sls高级状态

哪些机器执行哪些状态,top.sls必须放在base环境下

<span class="line">1</span>
2
3
4
<span class="line">[root@linux-node1 ~]<span class="comment"># vim /srv/salt/top.sls    </span></span>
<span class="line">base: <span class="comment"># 环境</span></span>
<span class="line">  <span class="string">'*'</span>:  <span class="comment"># 主机</span></span>
<span class="line">    - apache  <span class="comment"># 执行的状态</span></span>
  • minion卸载httpd httpd-tools软件包
<span class="line">1</span>
2
3
4
5
6
<span class="line">[root@linux-node2 ~]<span class="comment"># systemctl stop httpd</span></span>
<span class="line">[root@linux-node2 ~]<span class="comment"># systemctl disable httpd</span></span>
<span class="line">Removed symlink /etc/systemd/system/multi-user.target.wants/httpd.service.</span>
<span class="line">[root@linux-node2 ~]<span class="comment"># yum -y remove httpd httpd-tools</span></span>
<span class="line">[root@linux-node2 ~]<span class="comment"># lsof -i :80</span></span>
<span class="line">[root@linux-node2 ~]<span class="comment"># rpm -qa httpd httpd-tools</span></span>
  • 执行状态让minion安装并启动httpd
<span class="line">1</span>
<span class="line">2</span>
<span class="line">3</span>
<span class="line">4</span>
<span class="line">5</span>
<span class="line">6</span>
<span class="line">7</span>
<span class="line">8</span>
<span class="line">9</span>
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<span class="line">[root@linux-node1 ~]<span class="comment"># salt '*' state.highstate</span></span>
<span class="line">linux-node2.example.com:</span>
<span class="line">----------</span>
<span class="line">          ID: apache-install</span>
<span class="line">    Function: pkg.installed</span>
<span class="line">        Name: httpd</span>
<span class="line">      Result: True</span>
<span class="line">     Comment: Package httpd is already installed</span>
<span class="line">     Started: 19:59:31.765356</span>
<span class="line">    Duration: 585.161 ms</span>
<span class="line">     Changes:   </span>
<span class="line">----------</span>
<span class="line">          ID: apache-install</span>
<span class="line">    Function: pkg.installed</span>
<span class="line">        Name: httpd-tools</span>
<span class="line">      Result: True</span>
<span class="line">     Comment: Package httpd-tools is already installed</span>
<span class="line">     Started: 19:59:32.350668</span>
<span class="line">    Duration: 0.399 ms</span>
<span class="line">     Changes:   </span>
<span class="line">----------</span>
<span class="line">          ID: apache-service</span>
<span class="line">    Function: service.running</span>
<span class="line">        Name: httpd</span>
<span class="line">      Result: True</span>
<span class="line">     Comment: The service httpd is already running</span>
<span class="line">     Started: 19:59:32.351471</span>
<span class="line">    Duration: 23.968 ms</span>
<span class="line">     Changes:   </span>

<span class="line">Summary <span class="keyword">for</span> linux-node2.example.com</span>
<span class="line">------------</span>
<span class="line">Succeeded: 3</span>
<span class="line">Failed:    0</span>
<span class="line">------------</span>
<span class="line">Total states run:     3</span>
  • 检查是否启动
<span class="line">1</span>
<span class="line">2</span>
<span class="line">3</span>
<span class="line">4</span>
<span class="line">5</span>
<span class="line">6</span>
<span class="line">7</span>
<span class="line">8</span>
<span class="line">9</span>
10
11
<span class="line">[root@linux-node2 ~]<span class="comment"># rpm -qa httpd httpd-tools</span></span>
<span class="line">httpd-tools-2.4.6-40.el7.centos.1.x86_64</span>
<span class="line">httpd-2.4.6-40.el7.centos.1.x86_64</span>
<span class="line">[root@linux-node2 ~]<span class="comment"># lsof -i :80              </span></span>
<span class="line">COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME</span>
<span class="line">httpd   16384   root    4u  IPv6  38301      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16385 apache    4u  IPv6  38301      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16386 apache    4u  IPv6  38301      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16387 apache    4u  IPv6  38301      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16388 apache    4u  IPv6  38301      0t0  TCP *:http (LISTEN)</span>
<span class="line">httpd   16389 apache    4u  IPv6  38301      0t0  TCP *:http (LISTEN)</span>

本篇初始SaltStack就先到这儿把,继续写数据系统….

admin
版权声明:本站原创文章,由admin2016-07-16发表,共计9857字。
转载提示:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)