《SaltStack技术入门与实践》—— 实践案例 <中小型Web架构>2 Keepalived

实践案例 <中小型Web架构>2

本章节参考《SaltStack技术入门与实践》,感谢该书作者: 刘继伟、沈灿、赵舜东(本章节中有好几处错误)

Keepalived配置管理

  首先放置源码包、Keepalived的启动脚本、sysconfig配置文件在/srv/salt/prod/keepalived/files目录下。启动脚本和配置文件都可以从源码包中获取到。

What is Keepalived ?
Keepalived is a routing software written in C. The main goal of this project is to provide simple and robust facilities for loadbalancing and high-availability to Linux system and Linux based infrastructures. Loadbalancing framework relies on well-known and widely used Linux Virtual Server (IPVS) kernel module providing Layer4 loadbalancing. Keepalived implements a set of checkers to dynamically and adaptively maintain and manage loadbalanced server pool according their health. On the other hand high-availability is achieved by VRRP protocol. VRRP is a fundamental brick for router failover. In addition, Keepalived implements a set of hooks to the VRRP finite state machine providing low-level and high-speed protocol interactions. Keepalived frameworks can be used independently or all together to provide resilient infrastructures.
kepipalvef是一个用c语言编写的路由软件。该项目的主要目标是为linux系统和基于linux的基础设施提供负载均衡和高可用性的简单而健壮的工具。负载平衡框架依赖于著名的和广泛使用的linux虚拟服务器(ipvs)内核模块,提供层4负载平衡。keapiview实现了一组检查程序,以动态和自适应地维护和管理负载均衡服务器池。另一方面,通过vrrp协议实现了高可用性。vrrp是路由器故障转移的基础砖。此外,keipalview实现了一组钩子到vrrp有限状态机,提供低级和高速协议交互。keipalived框架可以独立使用,或者一起使用以提供弹性基础结构。 

软件包准备

注意:
这里遇到个坑,keepalived-2.0.4有个bug,make不过去
[root@SaltMaster1(10.182.88.136)]$~:>cd /srv/salt/prod/keepalived/files/
[root@SaltMaster1(10.182.88.136)]$files:>tar -zxf keepalived-2.0.5.tar.gz 
[root@SaltMaster1(10.182.88.136)]$files:>cd keepalived-2.0.5
[root@SaltMaster1(10.182.88.136)]$keepalived-2.0.5:>ls -l
total 992
-rw-rw-r-- 1 1000 1000     41 Jun  7 02:42 AUTHOR
-rw-rw-r-- 1 1000 1000    823 Jun  7 02:42 CONTRIBUTORS
-rw-rw-r-- 1 1000 1000  18092 Jun  7 02:42 COPYING
-rw-rw-r-- 1 1000 1000 354034 Jun 29 17:38 ChangeLog
-rw-rw-r-- 1 1000 1000   6257 Jun  7 02:42 INSTALL
-rw-rw-r-- 1 1000 1000   1818 Jun 29 16:37 Makefile.am
-rw-rw-r-- 1 1000 1000  28799 Jun 29 17:41 Makefile.in
-rw-rw-r-- 1 1000 1000   1437 Jun  7 02:42 README.md
-rw-rw-r-- 1 1000 1000   5094 Jun 29 16:37 TODO
-rw-rw-r-- 1 1000 1000  54381 Jun 29 17:41 aclocal.m4
-rwxr-xr-x 1 1000 1000   5826 Mar 30  2016 ar-lib
drwxrwxr-x 2 1000 1000     44 Jun 29 17:41 bin_install
-rwxr-xr-x 1 1000 1000   7333 Mar 30  2016 compile
-rwxrwxr-x 1 1000 1000 366334 Jun 29 17:41 configure
-rw-rw-r-- 1 1000 1000  64723 Jun 29 16:37 configure.ac
-rwxr-xr-x 1 1000 1000  23566 Mar 30  2016 depcomp
drwxrwxr-x 5 1000 1000    210 Jun 29 17:41 doc
drwxrwxr-x 3 1000 1000    205 Jun 29 17:41 genhash
-rwxr-xr-x 1 1000 1000  15155 Mar 30  2016 install-sh
drwxrwxr-x 9 1000 1000    173 Jun 29 17:41 keepalived
-rw-rw-r-- 1 1000 1000   8607 Jun  7 02:42 keepalived.spec.in
drwxrwxr-x 2 1000 1000   4096 Jun 29 17:41 lib
-rwxr-xr-x 1 1000 1000   6872 Mar 30  2016 missing
drwxrwxr-x 2 1000 1000     28 Jun  7 02:42 snap
[root@SaltMaster1(10.182.88.136)]$keepalived-2.0.5:>

  将Keepalvied需要的init脚本和sysconfig复制到files目录下:

[root@SaltMaster1(10.182.88.136)]$files:>ll
total 836
drwxrwxr-x 8 1000 1000   4096 Jun 29 17:41 keepalived-2.0.5
-rw-r--r-- 1 root root 848206 Jul  3 14:28 keepalived-2.0.5.tar.gz
[root@SaltMaster1(10.182.88.136)]$files:>cp /srv/salt/prod/keepalived/files/keepalived-2.0.5/keepalived/etc/init.d/keepalived /srv/salt/prod/keepalived/files/
[root@SaltMaster1(10.182.88.136)]$files:>cp /srv/salt/prod/keepalived/files/keepalived-2.0.5/keepalived/etc/sysconfig/keepalived /srv/salt/prod/keepalived/files/keepalived.sysconfig
[root@SaltMaster1(10.182.88.136)]$files:>ll
total 844
-rwxr-xr-x 1 root root   1308 Jul  3 14:42 keepalived
drwxrwxr-x 8 1000 1000   4096 Jun 29 17:41 keepalived-2.0.5
-rw-r--r-- 1 root root 848206 Jul  3 14:28 keepalived-2.0.5.tar.gz
-rw-r--r-- 1 root root    667 Jul  3 14:42 keepalived.sysconfig
[root@SaltMaster1(10.182.88.136)]$files:>

  由于我们本次默认安装Keepalived到/export/servers/keepalived目录下,所以需要手动修改源码包里面的init脚本:

#vim keepalived
#将daemon keepalived ${KEEPALIVED_OPTIONS}
#修改为 daemon /usr/local/keepalived/sbin/keepalived${KEEPALIVED_OPTIONS}

  或者使用sed直接修改:

[root@SaltMaster1(10.182.88.136)]$files:>sed -i 's#/usr/local/keepalived/sbin/keepalived#/export/servers/keepalived/sbin/keepalived#g' keepalived
[root@SaltMaster1(10.182.88.136)]$files:>grep daemon keepalived
# Startup script for the Keepalived daemon
    daemon /export/servers/keepalived/sbin/keepalived ${KEEPALIVED_OPTIONS}

编写Keepalived安装SLS

  然后我们就开始编写Keepalived的安装与配置:

[root@SaltMaster1(10.182.88.136)]$~:>more /srv/salt/prod/keepalived/install.sls 
include:
  - pkg.pkg-init

pkg-additional:
  pkg.installed:
    - names:
      - curl
      - gcc
      - openssl-devel
      - libnl3-devel
      - net-snmp-devel
      - libnfnetlink
      - libnl.x86_64
      - libnl-devel.x86_64
      - libnl3.x86_64
      - libnl3-devel.x86_64
      - libnfnetlink-devel.x86_64

keepalived-install:
  file.managed:
    - name: /tmp/keepalived-2.0.5.tar.gz
    - source: salt://keepalived/files/keepalived-2.0.5.tar.gz
    - mode: 755
    - user: root
    - group: root
    
  cmd.run:
    - name: cd /tmp/ && tar zxf keepalived-2.0.5.tar.gz && cd keepalived-2.0.5 &&./configure --prefix=/export/servers/keepalived && make -j 4 && make install
    - unless: test -d /export/servers/keepalived
    - mkdir: 
    - require:
      - pkg: pkg-init
      - pkg: pkg-additional
      - file: keepalived-install

keepalived-init:
  file.managed:
    - name: /etc/init.d/keepalived
    - source: salt://keepalived/files/keepalived
    - user: root
    - group: root
    - mode: 755

  cmd.run:
    - name: chkconfig --add keepalived
    - unless: ckconfig --list|grep keepalived
    - require:
      - file: keepalived-init

/etc/sysconfig/keepalived:
  file.managed:
    - source: salt://keepalived/files/keepalived.sysconfig
    - user: root
    - group: root
    - mode: 644

/export/servers/keepalived:
  file.directory:
    - user: root
    - group: root
    - mode: 755

Keepalived业务引用

  和Haproxy一样,我们需要一个Keepalived的配置文件,不过这次配置文件和Haproxy文件稍有不同,因为Keepalived分为主、备节点,一些配置在主节点和备节点上是不同的。我们需要使用Jinja模版来完成配置文件的管理。下面列出了Keepalived做Haproxy高可用的一个最小化的配置模版,请将该模版文件放置在/srv/salt/prod/cluster/files/目录下。

[root@SaltMaster1(10.182.88.136)]$~:>cd /srv/salt/prod/cluster/files/
[root@SaltMaster1(10.182.88.136)]$files:>more haproxy-service-keepalived.conf 
! Configuration File for keepalived
global_defs {
   notification_email {
     saltstack@example.com
   }
   notification_email_from keepalived@example.com
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id {{ROUTEID}}
}
vrrp_instance haproxy_ha {
state {{STATEID}}
interface eth0
    virtual_router_id 36
priority {{PRIORITYID}}
    advert_int 1
authentication {
auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
       10.182.76.77
    }
}

  下面我们在Cluster业务目录下编写Haproxy使用Keepalived做高可用的sls(我实验机的PS1非我主机名)

[root@SaltMaster1(10.182.88.136)]$files:>vim haproxy-service-keepalived.sls
[root@SaltMaster1(10.182.88.136)]$files:>more haproxy-service-keepalived.sls
include:
  - keepalived.install

keepalived-service:
  file.managed:
    - name: /export/servers/keepalived/etc/keepalived/keepalived.conf
- source: salt://cluster/files/haproxy-service-keepalived.conf - user: root - group: root - mode: 644 - template: jinja {% if grains['fqdn'] == 'saltstack-master.example.com' %} - ROUTEID: haproxy_ha - STATEID: MASTER - PRIORITYID: 150 {% elif grains['fqdn'] == 'saltstack-minion.example.com' %} - ROUTEID: haproxy_ha - STATEID: BACKUP - PRIORITYID: 100 {% endif %} service.running: - name: keepalived - enable: True - watch: - file: keepalived-service

执行Keepalvied状态 

  编写完毕Keepalived的状态管理后,就可以在top file里面指定Minion运行该状态:

[root@SaltMaster1(10.182.88.136)]$files:>more /srv/salt/base/top.sls 
#base:
#  '*':
#    - init.init
base:
  '*':
    - init.env_init
prod:
  '*':
    - cluster.haproxy-service
    - cluster.haproxy-service-keepalived
#    - cluster.haproxy-outside
#    - keepalived.install
[root@SaltMaster1(10.182.88.136)]$files:>tree /srv/salt/prod/cluster/
/srv/salt/prod/cluster/
|-- config
|-- files
|   |-- haproxy-outside.cfg
|   |-- haproxy-service-keepalived.conf
|   `-- haproxy-service-keepalived.sls
`-- haproxy-outside.sls

2 directories, 4 files

执行状态如下:

[root@SaltMaster1(10.182.88.136)]$~:>salt '10.182.76.78' state.highstate test=True

[root@SaltMaster1(10.182.88.136)]$~:>salt '10.182.76.78' state.highstate test=True
10.182.76.78:
----------
          ID: /etc/resolv.conf
    Function: file.managed
      Result: True
     Comment: The file /etc/resolv.conf is in the correct state
     Started: 15:32:28.123030
    Duration: 33.48 ms
     Changes:   
----------
          ID: /etc/profile
    Function: file.append
      Result: True
     Comment: File /etc/profile is in correct state
     Started: 15:32:28.156771
    Duration: 4.672 ms
     Changes:   
----------
          ID: /etc/bashrc
    Function: file.append
      Result: True
     Comment: File /etc/bashrc is in correct state
     Started: 15:32:28.161644
    Duration: 4.64 ms
     Changes:   
----------
          ID: net.ipv4.ip_forward
    Function: sysctl.present
      Result: True
     Comment: Sysctl value net.ipv4.ip_forward = 1 is already set
     Started: 15:32:28.168499
    Duration: 351.02 ms
     Changes:   
----------
          ID: net.ipv4.conf.default.rp_filter
    Function: sysctl.present
      Result: True
     Comment: Sysctl value net.ipv4.conf.default.rp_filter = 1 is already set
     Started: 15:32:28.519879
    Duration: 347.363 ms
     Changes:   
----------
          ID: net.ipv4.conf.default.accept_source_route
    Function: sysctl.present
      Result: True
     Comment: Sysctl value net.ipv4.conf.default.accept_source_route = 0 is already set
     Started: 15:32:28.867607
    Duration: 348.211 ms
     Changes:   
----------
          ID: kernel.sysrq
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.sysrq = 0 is already set
     Started: 15:32:29.216188
    Duration: 347.76 ms
     Changes:   
----------
          ID: kernel.core_uses_pid
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.core_uses_pid = 1 is already set
     Started: 15:32:29.564312
    Duration: 349.378 ms
     Changes:   
----------
          ID: kernel.msgmnb
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.msgmnb = 65536 is already set
     Started: 15:32:29.914047
    Duration: 349.128 ms
     Changes:   
----------
          ID: kernel.msgmax
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.msgmax = 65536 is already set
     Started: 15:32:30.263527
    Duration: 349.166 ms
     Changes:   
----------
          ID: kernel.shmmax
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.shmmax = 68719476736 is already set
     Started: 15:32:30.613060
    Duration: 350.354 ms
     Changes:   
----------
          ID: kernel.shmall
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.shmall = 4294967296 is already set
     Started: 15:32:30.963752
    Duration: 348.381 ms
     Changes:   
----------
          ID: yum_repo_release
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:32.410658
    Duration: 2169.392 ms
     Changes:   
----------
          ID: zabbix_repo_release
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:34.580409
    Duration: 664.375 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: gcc
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.245150
    Duration: 26.246 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: gcc-c++
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.271593
    Duration: 28.298 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: glibc
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.300218
    Duration: 24.299 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: make
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.324704
    Duration: 24.257 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: autoconf
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.349177
    Duration: 24.367 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: openssl
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.373739
    Duration: 24.27 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: openssl-devel
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.398213
    Duration: 24.344 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnfnetlink
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.422749
    Duration: 24.275 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnl.x86_64
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.447225
    Duration: 24.37 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnl-devel.x86_64
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.471775
    Duration: 24.224 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnl3.x86_64
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.496189
    Duration: 23.97 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnl3-devel.x86_64
      Result: True
     Comment: All specified packages are already installed
     Started: 15:32:35.520360
    Duration: 25.176 ms
     Changes:   
----------
          ID: keepalived-install
    Function: file.managed
        Name: /tmp/keepalived-2.0.5.tar.gz
      Result: True
     Comment: The file /tmp/keepalived-2.0.5.tar.gz is in the correct state
     Started: 15:32:35.545792
    Duration: 24.207 ms
     Changes:   
----------
          ID: keepalived-install
    Function: cmd.run
        Name: cd /tmp/ && tar zxf keepalived-2.0.5.tar.gz && cd keepalived-2.0.5 &&./configure --prefix=/export/servers/keepalived && make -j 4 && make install
      Result: True
     Comment: unless condition is true
     Started: 15:32:35.572486
    Duration: 159.067 ms
     Changes:   
----------
          ID: keepalived-init
    Function: file.managed
        Name: /etc/init.d/keepalived
      Result: None
     Comment: The file /etc/init.d/keepalived is set to be changed
     Started: 15:32:35.731965
    Duration: 27.657 ms
     Changes:   
              ----------
              diff:
                  --- 
                  +++ 
                  @@ -20,7 +20,7 @@
                   
                   start() {
                       echo -n $"Starting $prog: "
                  -    daemon /usr/local/keepalived/sbin/keepalived ${KEEPALIVED_OPTIONS}
                  +    daemon /export/servers/keepalived/sbin/keepalived ${KEEPALIVED_OPTIONS}
                       RETVAL=$?
                       echo
                       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
----------
          ID: keepalived-init
    Function: cmd.run
        Name: chkconfig --add keepalived
      Result: None
     Comment: Command "chkconfig --add keepalived" would have been executed
     Started: 15:32:35.760845
    Duration: 148.44 ms
     Changes:   
----------
          ID: /etc/sysconfig/keepalived
    Function: file.managed
      Result: True
     Comment: The file /etc/sysconfig/keepalived is in the correct state
     Started: 15:32:35.909637
    Duration: 6.9 ms
     Changes:   
----------
          ID: /export/servers/keepalived
    Function: file.directory
      Result: True
     Comment: The directory /export/servers/keepalived is in the correct state
     Started: 15:32:35.916751
    Duration: 1.377 ms
     Changes:   
----------
          ID: keepalived-service
    Function: file.managed
        Name: /export/servers/keepalived/etc/keepalived/keepalived.conf
      Result: True
     Comment: The file /export/servers/keepalived/etc/keepalived/keepalived.conf is in the correct state
     Started: 15:32:35.918349
    Duration: 33.972 ms
     Changes:   
----------
          ID: keepalived-service
    Function: service.running
        Name: keepalived
      Result: None
     Comment: Service keepalived is set to start
     Started: 15:32:35.953547
    Duration: 472.259 ms
     Changes:   

Summary for 10.182.76.78
-------------
Succeeded: 34 (unchanged=3, changed=1)
Failed:     0
-------------
Total states run:     34
Total run time:    7.189 s
View Code

[root@SaltMaster1(10.182.88.136)]$~:>salt '10.182.76.78' state.highstate

[root@SaltMaster1(10.182.88.136)]$~:>salt '10.182.88.136' state.highstate 
10.182.88.136:
----------
          ID: /etc/resolv.conf
    Function: file.managed
      Result: True
     Comment: File /etc/resolv.conf is in the correct state
     Started: 15:52:13.854630
    Duration: 41.573 ms
     Changes:   
----------
          ID: /etc/profile
    Function: file.append
      Result: True
     Comment: File /etc/profile is in correct state
     Started: 15:52:13.896533
    Duration: 5.275 ms
     Changes:   
----------
          ID: /etc/bashrc
    Function: file.append
      Result: True
     Comment: File /etc/bashrc is in correct state
     Started: 15:52:13.902031
    Duration: 4.857 ms
     Changes:   
----------
          ID: net.ipv4.ip_forward
    Function: sysctl.present
      Result: True
     Comment: Sysctl value net.ipv4.ip_forward = 1 is already set
     Started: 15:52:13.909147
    Duration: 160.025 ms
     Changes:   
----------
          ID: net.ipv4.conf.default.rp_filter
    Function: sysctl.present
      Result: True
     Comment: Sysctl value net.ipv4.conf.default.rp_filter = 1 is already set
     Started: 15:52:14.069589
    Duration: 165.994 ms
     Changes:   
----------
          ID: net.ipv4.conf.default.accept_source_route
    Function: sysctl.present
      Result: True
     Comment: Sysctl value net.ipv4.conf.default.accept_source_route = 0 is already set
     Started: 15:52:14.235950
    Duration: 152.941 ms
     Changes:   
----------
          ID: kernel.sysrq
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.sysrq = 0 is already set
     Started: 15:52:14.389230
    Duration: 165.704 ms
     Changes:   
----------
          ID: kernel.core_uses_pid
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.core_uses_pid = 1 is already set
     Started: 15:52:14.555351
    Duration: 164.274 ms
     Changes:   
----------
          ID: kernel.msgmnb
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.msgmnb = 65536 is already set
     Started: 15:52:14.720226
    Duration: 179.779 ms
     Changes:   
----------
          ID: kernel.msgmax
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.msgmax = 65536 is already set
     Started: 15:52:14.900344
    Duration: 152.813 ms
     Changes:   
----------
          ID: kernel.shmmax
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.shmmax = 68719476736 is already set
     Started: 15:52:15.053657
    Duration: 156.25 ms
     Changes:   
----------
          ID: kernel.shmall
    Function: sysctl.present
      Result: True
     Comment: Sysctl value kernel.shmall = 4294967296 is already set
     Started: 15:52:15.210247
    Duration: 166.678 ms
     Changes:   
----------
          ID: yum_repo_release
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:16.346191
    Duration: 2664.601 ms
     Changes:   
----------
          ID: zabbix_repo_release
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:19.011286
    Duration: 971.121 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: gcc
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:19.982799
    Duration: 35.884 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: gcc-c++
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.018932
    Duration: 34.171 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: glibc
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.053338
    Duration: 32.892 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: make
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.086464
    Duration: 32.854 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: autoconf
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.119560
    Duration: 33.201 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: openssl
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.153004
    Duration: 32.927 ms
     Changes:   
----------
          ID: pkg-init
    Function: pkg.installed
        Name: openssl-devel
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.186157
    Duration: 32.933 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: curl
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.219319
    Duration: 36.479 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: gcc
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.256208
    Duration: 29.383 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: openssl-devel
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.285779
    Duration: 28.823 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnl3-devel
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.314796
    Duration: 28.694 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: net-snmp-devel
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.343687
    Duration: 28.448 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnfnetlink
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.372323
    Duration: 28.503 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnl.x86_64
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.401024
    Duration: 30.371 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnl-devel.x86_64
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.431592
    Duration: 28.381 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnl3.x86_64
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.460164
    Duration: 28.256 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnl3-devel.x86_64
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.488614
    Duration: 28.308 ms
     Changes:   
----------
          ID: pkg-additional
    Function: pkg.installed
        Name: libnfnetlink-devel.x86_64
      Result: True
     Comment: All specified packages are already installed
     Started: 15:52:20.517123
    Duration: 28.229 ms
     Changes:   
----------
          ID: keepalived-install
    Function: file.managed
        Name: /tmp/keepalived-2.0.5.tar.gz
      Result: True
     Comment: File /tmp/keepalived-2.0.5.tar.gz is in the correct state
     Started: 15:52:20.545554
    Duration: 60.762 ms
     Changes:   
----------
          ID: keepalived-install
    Function: cmd.run
        Name: cd /tmp/ && tar zxf keepalived-2.0.5.tar.gz && cd keepalived-2.0.5 &&./configure --prefix=/export/servers/keepalived && make -j 4 && make install
      Result: True
     Comment: Command "cd /tmp/ && tar zxf keepalived-2.0.5.tar.gz && cd keepalived-2.0.5 &&./configure --prefix=/export/servers/keepalived && make -j 4 && make install" run
     Started: 15:52:20.609054
    Duration: 13152.152 ms
     Changes:   
              ----------
              pid:
                  62635
              retcode:
                  0
              stderr:
              stdout:
                  checking for a BSD-compatible install... /usr/bin/install -c
                  checking whether build environment is sane... yes
                  checking for a thread-safe mkdir -p... /bin/mkdir -p
                  checking for gawk... gawk
                  checking whether make sets $(MAKE)... yes
                  checking whether make supports nested variables... yes
                  checking whether make supports nested variables... (cached) yes
                  checking for pkg-config... /usr/bin/pkg-config
                  checking pkg-config is at least version 0.9.0... yes
                  checking for gcc... gcc
                  checking whether the C compiler works... yes
                  checking for C compiler default output file name... a.out
                  checking for suffix of executables... 
                  checking whether we are cross compiling... no
                  checking for suffix of object files... o
                  checking whether we are using the GNU C compiler... yes
                  checking whether gcc accepts -g... yes
                  checking for gcc option to accept ISO C89... none needed
                  checking whether gcc understands -c and -o together... yes
                  checking for style of include used by make... GNU
                  checking dependency style of gcc... gcc3
                  checking whether make sets $(MAKE)... (cached) yes
                  checking for ranlib... ranlib
                  checking for grep that handles long lines and -e... /bin/grep
                  checking whether ln -s works... yes
                  checking for a sed that does not truncate output... /bin/sed
                  checking for strip... strip
                  checking for ldd... ldd
                  checking for ar... ar
                  checking the archiver (ar) interface... ar
                  checking for -Wimplicit-fallthrough... no
                  checking for PIE support... yes
                  checking for -Wformat -Werror=format-security support... yes
                  checking for -Wp,-D_FORTIFY_SOURCE=2 support... yes
                  checking for -fexceptions support... yes
                  checking for -fstack-protector-strong support... no
                  checking for --param=ssp-buffer-size=4 support... yes
                  checking for -grecord-gcc-switches support... no
                  checking for -Wl,-z,relro support... yes
                  checking for -Wl,-z,now support... yes
                  checking for -O2 support... yes
                  checking how to run the C preprocessor... gcc -E
                  checking for egrep... /bin/grep -E
                  checking for ANSI C header files... yes
                  checking for sys/types.h... yes
                  checking for sys/stat.h... yes
                  checking for stdlib.h... yes
                  checking for string.h... yes
                  checking for memory.h... yes
                  checking for strings.h... yes
                  checking for inttypes.h... yes
                  checking for stdint.h... yes
                  checking for unistd.h... yes
                  checking arpa/inet.h usability... yes
                  checking arpa/inet.h presence... yes
                  checking for arpa/inet.h... yes
                  checking fcntl.h usability... yes
                  checking fcntl.h presence... yes
                  checking for fcntl.h... yes
                  checking limits.h usability... yes
                  checking limits.h presence... yes
                  checking for limits.h... yes
                  checking netdb.h usability... yes
                  checking netdb.h presence... yes
                  checking for netdb.h... yes
                  checking netinet/in.h usability... yes
                  checking netinet/in.h presence... yes
                  checking for netinet/in.h... yes
                  checking for stdint.h... (cached) yes
                  checking for stdlib.h... (cached) yes
                  checking for string.h... (cached) yes
                  checking sys/ioctl.h usability... yes
                  checking sys/ioctl.h presence... yes
                  checking for sys/ioctl.h... yes
                  checking sys/param.h usability... yes
                  checking sys/param.h presence... yes
                  checking for sys/param.h... yes
                  checking sys/prctl.h usability... yes
                  checking sys/prctl.h presence... yes
                  checking for sys/prctl.h... yes
                  checking sys/socket.h usability... yes
                  checking sys/socket.h presence... yes
                  checking for sys/socket.h... yes
                  checking sys/time.h usability... yes
                  checking sys/time.h presence... yes
                  checking for sys/time.h... yes
                  checking syslog.h usability... yes
                  checking syslog.h presence... yes
                  checking for syslog.h... yes
                  checking for unistd.h... (cached) yes
                  checking for linux/netlink.h... yes
                  checking for linux/rtnetlink.h... yes
                  checking asm/types.h usability... yes
                  checking asm/types.h presence... yes
                  checking for asm/types.h... yes
                  checking linux/ethtool.h usability... yes
                  checking linux/ethtool.h presence... yes
                  checking for linux/ethtool.h... yes
                  checking linux/icmpv6.h usability... yes
                  checking linux/icmpv6.h presence... yes
                  checking for linux/icmpv6.h... yes
                  checking linux/if_ether.h usability... yes
                  checking linux/if_ether.h presence... yes
                  checking for linux/if_ether.h... yes
                  checking linux/if_packet.h usability... yes
                  checking linux/if_packet.h presence... yes
                  checking for linux/if_packet.h... yes
                  checking linux/ip.h usability... yes
                  checking linux/ip.h presence... yes
                  checking for linux/ip.h... yes
                  checking linux/sockios.h usability... yes
                  checking linux/sockios.h presence... yes
                  checking for linux/sockios.h... yes
                  checking linux/types.h usability... yes
                  checking linux/types.h presence... yes
                  checking for linux/types.h... yes
                  checking for linux/fib_rules.h... yes
                  checking for linux/if_addr.h... yes
                  checking for linux/if_link.h... yes
                  checking for linux/if_arp.h... yes
                  checking for stdbool.h that conforms to C99... yes
                  checking for _Bool... yes
                  checking for inline... inline
                  checking for int64_t... yes
                  checking for pid_t... yes
                  checking for size_t... yes
                  checking for uint16_t... yes
                  checking for uint32_t... yes
                  checking for uint64_t... yes
                  checking for uint8_t... yes
                  checking for an ANSI C-conforming const... yes
                  checking vfork.h usability... no
                  checking vfork.h presence... no
                  checking for vfork.h... no
                  checking for fork... yes
                  checking for vfork... yes
                  checking for working fork... yes
                  checking for working vfork... (cached) yes
                  checking for stdlib.h... (cached) yes
                  checking for GNU libc compatible malloc... yes
                  checking for stdlib.h... (cached) yes
                  checking for GNU libc compatible realloc... yes
                  checking for dup2... yes
                  checking for getcwd... yes
                  checking for gettimeofday... yes
                  checking for memmove... yes
                  checking for memset... yes
                  checking for select... yes
                  checking for setenv... yes
                  checking for socket... yes
                  checking for strcasecmp... yes
                  checking for strchr... yes
                  checking for strdup... yes
                  checking for strerror... yes
                  checking for strpbrk... yes
                  checking for strstr... yes
                  checking for strtol... yes
                  checking for strtoul... yes
                  checking for uname... yes
                  checking for pipe2... yes
                  checking for signalfd... yes
                  checking for inotify_init1... yes
                  checking whether ETHERTYPE_IPV6 is declared... yes
                  checking openssl/ssl.h usability... yes
                  checking openssl/ssl.h presence... yes
                  checking for openssl/ssl.h... yes
                  checking openssl/err.h usability... yes
                  checking openssl/err.h presence... yes
                  checking for openssl/err.h... yes
                  checking openssl/md5.h usability... yes
                  checking openssl/md5.h presence... yes
                  checking for openssl/md5.h... yes
                  checking for MD5_Init in -lcrypto... yes
                  checking for SSL_CTX_new in -lssl... yes
                  checking SSL_set_tlsext_host_name() - may be a definition... yes
                  checking for SSL_CTX_set_verify_depth... yes
                  checking for SSL_set0_rbio... no
                  checking for OPENSSL_init_crypto... no
                  checking for nl_socket_alloc in -lnl-3... yes
                  checking for genl_connect in -lnl-genl-3... yes
                  checking whether IPV4_DEVCONF_ARP_IGNORE is declared... no
                  checking whether IPV4_DEVCONF_ACCEPT_LOCAL is declared... no
                  checking whether IPV4_DEVCONF_RP_FILTER is declared... no
                  checking whether IPV4_DEVCONF_ARPFILTER is declared... no
                  checking for linux/rtnetlink.h... (cached) yes
                  checking libnfnetlink/libnfnetlink.h usability... yes
                  checking libnfnetlink/libnfnetlink.h presence... yes
                  checking for libnfnetlink/libnfnetlink.h... yes
                  checking netlink/netlink.h usability... yes
                  checking netlink/netlink.h presence... yes
                  checking for netlink/netlink.h... yes
                  checking netlink/genl/ctrl.h usability... yes
                  checking netlink/genl/ctrl.h presence... yes
                  checking for netlink/genl/ctrl.h... yes
                  checking netlink/genl/genl.h usability... yes
                  checking netlink/genl/genl.h presence... yes
                  checking for netlink/genl/genl.h... yes
                  checking for magic_open in -lmagic... yes
                  checking whether RTA_ENCAP is declared... no
                  checking whether RTA_EXPIRES is declared... no
                  checking whether RTA_NEWDST is declared... no
                  checking whether RTA_PREF is declared... no
                  checking whether FRA_SUPPRESS_PREFIXLEN is declared... no
                  checking whether FRA_SUPPRESS_IFGROUP is declared... no
                  checking whether FRA_TUN_ID is declared... no
                  checking whether RTAX_CC_ALGO is declared... no
                  checking whether RTAX_QUICKACK is declared... no
                  checking whether RTEXT_FILTER_SKIP_STATS is declared... no
                  checking whether FRA_L3MDEV is declared... no
                  checking whether FRA_UID_RANGE is declared... no
                  checking whether RTAX_FASTOPEN_NO_COOKIE is declared... no
                  checking whether RTA_VIA is declared... no
                  checking whether FRA_OIFNAME is declared... no
                  checking whether FRA_PROTOCOL is declared... no
                  checking whether FRA_IP_PROTO is declared... no
                  checking whether FRA_SPORT_RANGE is declared... no
                  checking whether FRA_DPORT_RANGE is declared... no
                  checking whether IFA_FLAGS is declared... no
                  checking whether IP_MULTICAST_ALL is declared... no
                  checking whether LWTUNNEL_ENCAP_MPLS is declared... no
                  checking whether LWTUNNEL_ENCAP_ILA is declared... no
                  checking linux/netfilter/x_tables.h usability... yes
                  checking linux/netfilter/x_tables.h presence... yes
                  checking for linux/netfilter/x_tables.h... yes
                  checking xtables.h usability... no
                  checking xtables.h presence... no
                  checking for xtables.h... no
                  checking for linux/if.h and net/if.h namespace collision... yes
                  checking for linux/if_ether.h then netinet/if_ether.h namespace collision... no
                  checking for libiptc/libiptc.h linux/if.h and net/if.h namespace collision... yes
                  checking linux/ip_vs.h usability... yes
                  checking linux/ip_vs.h presence... yes
                  checking for linux/ip_vs.h... yes
                  checking whether IP_VS_SVC_F_ONEPACKET is declared... yes
                  checking whether IPVS_DEST_ATTR_ADDR_FAMILY is declared... no
                  checking whether IPVS_DAEMON_ATTR_SYNC_MAXLEN is declared... no
                  checking whether IPVS_DAEMON_ATTR_MCAST_GROUP is declared... no
                  checking whether IPVS_DAEMON_ATTR_MCAST_GROUP6 is declared... no
                  checking whether IPVS_DAEMON_ATTR_MCAST_PORT is declared... no
                  checking whether IPVS_DAEMON_ATTR_MCAST_TTL is declared... no
                  checking whether IPVS_SVC_ATTR_STATS64 is declared... no
                  checking whether IPVS_DEST_ATTR_STATS64 is declared... no
                  checking whether IFLA_MACVLAN_MODE is declared... yes
                  checking whether MACVLAN_MODE_PRIVATE is declared... yes
                  checking whether SOCK_NONBLOCK is declared... yes
                  checking whether SOCK_CLOEXEC is declared... yes
                  checking whether IPVS_SVC_ATTR_PE_NAME is declared... yes
                  checking whether O_PATH is declared... no
                  checking whether GLOB_BRACE is declared... yes
                  checking whether FRA_SRC is declared... yes
                  checking whether IFLA_INET6_ADDR_GEN_MODE is declared... no
                  checking whether SO_MARK is declared... yes
                  checking whether CLONE_NEWNET is declared... yes
                  checking for setns... no
                  checking whether SCHED_RR is declared... yes
                  checking whether RLIMIT_RTTIME is declared... no
                  checking whether SCHED_RESET_ON_FORK is declared... yes
                  checking for sphinx-build... No
                  checking for rpm... Yes
                  checking for rpmbuild... Yes
                  
                  checking that generated files are newer than configure... done
                  configure: creating ./config.status
                  config.status: creating Makefile
                  config.status: creating keepalived/Makefile
                  config.status: creating lib/Makefile
                  config.status: creating keepalived/core/Makefile
                  config.status: creating keepalived.spec
                  config.status: creating genhash/Makefile
                  config.status: creating keepalived/check/Makefile
                  config.status: creating keepalived/vrrp/Makefile
                  config.status: creating keepalived/bfd/Makefile
                  config.status: creating doc/Makefile
                  config.status: creating bin_install/Makefile
                  config.status: creating keepalived/dbus/Makefile
                  config.status: creating keepalived/etc/Makefile
                  config.status: creating keepalived/etc/init/Makefile
                  config.status: creating keepalived/etc/init.d/Makefile
                  config.status: creating lib/config.h
                  config.status: lib/config.h is unchanged
                  config.status: executing depfiles commands
                  
                  Keepalived configuration
                  ------------------------
                  Keepalived version       : 2.0.5
                  Compiler                 : gcc
                  Preprocessor flags       :  -I/usr/include/libnl3 
                  Compiler flags           : -Wall -Wunused -Wstrict-prototypes -Wextra -Winit-self -g -D_GNU_SOURCE -fPIE -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -O2  
                  Linker flags             :  -pie
                  Extra Lib                :  -lcrypto  -lssl  -lnl-genl-3 -lnl-3  -lmagic
                  Use IPVS Framework       : Yes
                  IPVS use libnl           : Yes
                  IPVS syncd attributes    : No
                  IPVS 64 bit stats        : No
                  fwmark socket support    : Yes
                  Use VRRP Framework       : Yes
                  Use VRRP VMAC            : Yes
                  Use VRRP authentication  : Yes
                  With ip rules/routes     : Yes
                  Use BFD Framework        : No
                  SNMP vrrp support        : No
                  SNMP checker support     : No
                  SNMP RFCv2 support       : No
                  SNMP RFCv3 support       : No
                  DBUS support             : No
                  SHA1 support             : No
                  Use Json output          : No
                  libnl version            : 3
                  Use IPv4 devconf         : No
                  Use libiptc              : No
                  Use libipset             : No
                  init type                : upstart
                  Build genhash            : Yes
                  Build documentation      : No
                  Making all in lib
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/lib'
                  make  all-am
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/lib'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/lib'
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/lib'
                  Making all in keepalived
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/keepalived'
                  Making all in core
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived/core'
                  make[2]: Nothing to be done for `all'.
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/core'
                  Making all in vrrp
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived/vrrp'
                  make[2]: Nothing to be done for `all'.
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/vrrp'
                  Making all in check
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived/check'
                  make[2]: Nothing to be done for `all'.
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/check'
                  Making all in etc
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  Making all in init
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc/init'
                    EDIT     keepalived.conf
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc/init'
                  Making all in init.d
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc/init.d'
                  make[3]: Nothing to be done for `all'.
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc/init.d'
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  make[3]: Nothing to be done for `all-am'.
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived'
                  make[2]: Nothing to be done for `all-am'.
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived'
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/keepalived'
                  Making all in doc
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/doc'
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/doc'
                  Making all in genhash
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/genhash'
                  make[1]: Nothing to be done for `all'.
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/genhash'
                  Making all in bin_install
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/bin_install'
                  make[1]: Nothing to be done for `all'.
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/bin_install'
                  make[1]: Entering directory `/tmp/keepalived-2.0.5'
                  make[1]: Nothing to be done for `all-am'.
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5'
                  Making install in lib
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/lib'
                  make  install-am
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/lib'
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/lib'
                  make[3]: Nothing to be done for `install-exec-am'.
                  make[3]: Nothing to be done for `install-data-am'.
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/lib'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/lib'
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/lib'
                  Making install in keepalived
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/keepalived'
                  Making install in core
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived/core'
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived/core'
                  make[3]: Nothing to be done for `install-exec-am'.
                  make[3]: Nothing to be done for `install-data-am'.
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/core'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/core'
                  Making install in vrrp
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived/vrrp'
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived/vrrp'
                  make[3]: Nothing to be done for `install-exec-am'.
                  make[3]: Nothing to be done for `install-data-am'.
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/vrrp'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/vrrp'
                  Making install in check
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived/check'
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived/check'
                  make[3]: Nothing to be done for `install-exec-am'.
                  make[3]: Nothing to be done for `install-data-am'.
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/check'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/check'
                  Making install in etc
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  Making install in init
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc/init'
                  make[4]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc/init'
                  make[4]: Nothing to be done for `install-exec-am'.
                   /bin/mkdir -p '/export/servers/keepalived/etc/init'
                   /usr/bin/install -c -m 644 keepalived.conf '/export/servers/keepalived/etc/init'
                  make[4]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc/init'
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc/init'
                  Making install in init.d
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc/init.d'
                  make[4]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc/init.d'
                  make[4]: Nothing to be done for `install-exec-am'.
                  make[4]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc/init.d'
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc/init.d'
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  make[4]: Entering directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  make[4]: Nothing to be done for `install-exec-am'.
                  make[4]: Nothing to be done for `install-data-am'.
                  make[4]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived/etc'
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/keepalived'
                  make[3]: Entering directory `/tmp/keepalived-2.0.5/keepalived'
                   /bin/mkdir -p '/export/servers/keepalived/sbin'
                    /usr/bin/install -c keepalived '/export/servers/keepalived/sbin'
                   /bin/mkdir -p '/export/servers/keepalived/etc/keepalived'
                   /usr/bin/install -c -m 644 etc/keepalived/keepalived.conf '/export/servers/keepalived/etc/keepalived'
                   /bin/mkdir -p '/export/servers/keepalived/etc/sysconfig'
                   /usr/bin/install -c -m 644 etc/sysconfig/keepalived '/export/servers/keepalived/etc/sysconfig'
                  make[3]: Leaving directory `/tmp/keepalived-2.0.5/keepalived'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/keepalived'
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/keepalived'
                  Making install in doc
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/doc'
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/doc'
                  make[2]: Nothing to be done for `install-exec-am'.
                   /bin/mkdir -p '/export/servers/keepalived/share/man/man1'
                   /usr/bin/install -c -m 644 man/man1/genhash.1 '/export/servers/keepalived/share/man/man1'
                   /bin/mkdir -p '/export/servers/keepalived/share/man/man5'
                   /usr/bin/install -c -m 644 man/man5/keepalived.conf.5 '/export/servers/keepalived/share/man/man5'
                   /bin/mkdir -p '/export/servers/keepalived/share/man/man8'
                   /usr/bin/install -c -m 644 man/man8/keepalived.8 '/export/servers/keepalived/share/man/man8'
                   /bin/mkdir -p '/export/servers/keepalived/share/snmp/mibs'
                   /bin/mkdir -p '/export/servers/keepalived/etc/keepalived/samples'
                   /usr/bin/install -c -m 644 ./samples/client.pem ./samples/dh1024.pem ./samples/keepalived.conf.HTTP_GET.port ./samples/keepalived.conf.IPv6 ./samples/keepalived.conf.SMTP_CHECK ./samples/keepalived.conf.SSL_GET ./samples/keepalived.conf.conditional_conf ./samples/keepalived.conf.fwmark ./samples/keepalived.conf.inhibit ./samples/keepalived.conf.misc_check ./samples/keepalived.conf.misc_check_arg ./samples/keepalived.conf.quorum ./samples/keepalived.conf.sample ./samples/keepalived.conf.status_code ./samples/keepalived.conf.track_interface ./samples/keepalived.conf.virtual_server_group ./samples/keepalived.conf.virtualhost ./samples/keepalived.conf.vrrp ./samples/keepalived.conf.vrrp.localcheck ./samples/keepalived.conf.vrrp.lvs_syncd ./samples/keepalived.conf.vrrp.routes ./samples/keepalived.conf.vrrp.rules ./samples/keepalived.conf.vrrp.scripts ./samples/keepalived.conf.vrrp.static_ipaddress ./samples/keepalived.conf.vrrp.sync ./samples/root.pem ./samples/sample.misccheck.smbcheck.sh ./samples/sample_notify_fifo.sh '/export/servers/keepalived/etc/keepalived/samples'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/doc'
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/doc'
                  Making install in genhash
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/genhash'
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/genhash'
                   /bin/mkdir -p '/export/servers/keepalived/bin'
                    /usr/bin/install -c genhash '/export/servers/keepalived/bin'
                  make[2]: Nothing to be done for `install-data-am'.
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/genhash'
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/genhash'
                  Making install in bin_install
                  make[1]: Entering directory `/tmp/keepalived-2.0.5/bin_install'
                  make[2]: Entering directory `/tmp/keepalived-2.0.5/bin_install'
                  make[2]: Nothing to be done for `install-exec-am'.
                  make[2]: Nothing to be done for `install-data-am'.
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5/bin_install'
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5/bin_install'
                  make[1]: Entering directory `/tmp/keepalived-2.0.5'
                  make[2]: Entering directory `/tmp/keepalived-2.0.5'
                  make[2]: Nothing to be done for `install-exec-am'.
                   /bin/mkdir -p '/export/servers/keepalived/share/doc/keepalived'
                   /usr/bin/install -c -m 644 README '/export/servers/keepalived/share/doc/keepalived'
                  make[2]: Leaving directory `/tmp/keepalived-2.0.5'
                  make[1]: Leaving directory `/tmp/keepalived-2.0.5'
----------
          ID: keepalived-init
    Function: file.managed
        Name: /etc/init.d/keepalived
      Result: True
     Comment: File /etc/init.d/keepalived is in the correct state
     Started: 15:52:33.761820
    Duration: 21.004 ms
     Changes:   
----------
          ID: keepalived-init
    Function: cmd.run
        Name: chkconfig --add keepalived
      Result: True
     Comment: Command "chkconfig --add keepalived" run
     Started: 15:52:33.784668
    Duration: 369.001 ms
     Changes:   
              ----------
              pid:
                  66459
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: /etc/sysconfig/keepalived
    Function: file.managed
      Result: True
     Comment: File /etc/sysconfig/keepalived is in the correct state
     Started: 15:52:34.154188
    Duration: 61.7 ms
     Changes:   
----------
          ID: /export/servers/keepalived
    Function: file.directory
      Result: True
     Comment: The directory /export/servers/keepalived is in the correct state
     Started: 15:52:34.216258
    Duration: 1.811 ms
     Changes:   
----------
          ID: keepalived-service
    Function: file.managed
        Name: /export/servers/keepalived/etc/keepalived/keepalived.conf
      Result: True
     Comment: File /export/servers/keepalived/etc/keepalived/keepalived.conf updated
     Started: 15:52:34.218318
    Duration: 44.894 ms
     Changes:   
              ----------
              diff:
                  --- 
                  +++ 
                  @@ -1,157 +1,24 @@
                   ! Configuration File for keepalived
                  -
                   global_defs {
                      notification_email {
                  -     acassen@firewall.loc
                  -     failover@firewall.loc
                  -     sysadmin@firewall.loc
                  +     saltstack@example.com
                      }
                  -   notification_email_from Alexandre.Cassen@firewall.loc
                  -   smtp_server 192.168.200.1
                  +   notification_email_from keepalived@example.com
                  +   smtp_server 127.0.0.1
                      smtp_connect_timeout 30
                  -   router_id LVS_DEVEL
                  -   vrrp_skip_check_adv_addr
                  -   vrrp_strict
                  -   vrrp_garp_interval 0
                  -   vrrp_gna_interval 0
                  +   router_id haproxy_ha
                   }
                  -
                  -vrrp_instance VI_1 {
                  -    state MASTER
                  -    interface eth0
                  -    virtual_router_id 51
                  -    priority 100
                  +vrrp_instance haproxy_ha {
                  +state MASTER
                  +interface eth0
                  +    virtual_router_id 36
                  +priority 150
                       advert_int 1
                  -    authentication {
                  -        auth_type PASS
                  +authentication {
                  +auth_type PASS
                           auth_pass 1111
                       }
                       virtual_ipaddress {
                  -        192.168.200.16
                  -        192.168.200.17
                  -        192.168.200.18
                  +       10.182.76.78
                       }
                   }
                  -
                  -virtual_server 192.168.200.100 443 {
                  -    delay_loop 6
                  -    lb_algo rr
                  -    lb_kind NAT
                  -    persistence_timeout 50
                  -    protocol TCP
                  -
                  -    real_server 192.168.201.100 443 {
                  -        weight 1
                  -        SSL_GET {
                  -            url {
                  -              path /
                  -              digest ff20ad2481f97b1754ef3e12ecd3a9cc
                  -            }
                  -            url {
                  -              path /mrtg/
                  -              digest 9b3a0c85a887a256d6939da88aabd8cd
                  -            }
                  -            connect_timeout 3
                  -            retry 3
                  -            delay_before_retry 3
                  -        }
                  -    }
                  -}
                  -
                  -virtual_server 10.10.10.2 1358 {
                  -    delay_loop 6
                  -    lb_algo rr
                  -    lb_kind NAT
                  -    persistence_timeout 50
                  -    protocol TCP
                  -
                  -    sorry_server 192.168.200.200 1358
                  -
                  -    real_server 192.168.200.2 1358 {
                  -        weight 1
                  -        HTTP_GET {
                  -            url {
                  -              path /testurl/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334d
                  -            }
                  -            url {
                  -              path /testurl2/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334d
                  -            }
                  -            url {
                  -              path /testurl3/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334d
                  -            }
                  -            connect_timeout 3
                  -            retry 3
                  -            delay_before_retry 3
                  -        }
                  -    }
                  -
                  -    real_server 192.168.200.3 1358 {
                  -        weight 1
                  -        HTTP_GET {
                  -            url {
                  -              path /testurl/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334c
                  -            }
                  -            url {
                  -              path /testurl2/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334c
                  -            }
                  -            connect_timeout 3
                  -            retry 3
                  -            delay_before_retry 3
                  -        }
                  -    }
                  -}
                  -
                  -virtual_server 10.10.10.3 1358 {
                  -    delay_loop 3
                  -    lb_algo rr
                  -    lb_kind NAT
                  -    persistence_timeout 50
                  -    protocol TCP
                  -
                  -    real_server 192.168.200.4 1358 {
                  -        weight 1
                  -        HTTP_GET {
                  -            url {
                  -              path /testurl/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334d
                  -            }
                  -            url {
                  -              path /testurl2/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334d
                  -            }
                  -            url {
                  -              path /testurl3/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334d
                  -            }
                  -            connect_timeout 3
                  -            retry 3
                  -            delay_before_retry 3
                  -        }
                  -    }
                  -
                  -    real_server 192.168.200.5 1358 {
                  -        weight 1
                  -        HTTP_GET {
                  -            url {
                  -              path /testurl/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334d
                  -            }
                  -            url {
                  -              path /testurl2/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334d
                  -            }
                  -            url {
                  -              path /testurl3/test.jsp
                  -              digest 640205b7b0fc66c1ea91c463fac6334d
                  -            }
                  -            connect_timeout 3
                  -            retry 3
                  -            delay_before_retry 3
                  -        }
                  -    }
                  -}
----------
          ID: keepalived-service
    Function: service.running
        Name: keepalived
      Result: False
     Comment: Service keepalived has been enabled, and is dead
     Started: 15:52:34.264736
    Duration: 3058.79 ms
     Changes:   
              ----------
              keepalived:
                  True

Summary for 10.182.88.136
-------------
Succeeded: 39 (changed=4)
Failed:     1
-------------
Total states run:     40
Total run time:   22.481 s
View Code

部署安装都没有问题,服务启动有问题,后指定keepalived.conf路径启动成功。

daemon /export/servers/keepalived/sbin/keepalived ${KEEPALIVED_OPTIONS} -f /export/servers/keepalived/etc/keepalived/keepalived.conf

[root@SaltMaster1(10.182.88.136)]$~:>/export//servers/keepalived/sbin/keepalived -D -f /export/servers/keepalived/etc/keepalived/keepalived.conf
[root@SaltMaster1(10.182.88.136)]$~:>ps -ef |grep keep
root      68112      1  0 16:11 ?        00:00:00 /export//servers/keepalived/sbin/keepalived -D -f /export/servers/keepalived/etc/keepalived/keepalived.conf
root      68114  68112  0 16:11 ?        00:00:00 /export//servers/keepalived/sbin/keepalived -D -f /export/servers/keepalived/etc/keepalived/keepalived.conf
root      68124  46668  0 16:11 pts/0    00:00:00 grep --color keep
——————————————————————
[root@SaltMinion2(10.182.76.78)]$keepalived:>/export//servers/keepalived/sbin/keepalived -D -f /export/servers/keepalived/etc/keepalived/keepalived.conf
[root@SaltMinion2(10.182.76.78)]$keepalived:>ps -ef 
UID         PID   PPID  C STIME TTY          TIME CMD
root          1      0  0 Jun15 ?        00:00:00 sh start.sh
root         39      1  0 Jun15 ?        00:00:05 crond
root         55      1  0 Jun15 ?        00:00:03 /usr/sbin/sshd
root         57      1  0 Jun15 ?        00:00:00 sleep 9999999d
nscd         79      1  0 Jun15 ?        00:00:26 /usr/sbin/nscd
root       8833      0  0 Jun15 ?        00:00:00 /bin/sh -i
root      49471      1  0 Jun19 ?        00:00:21 /usr/bin/python2.7 /usr/bin/salt-minion -c /etc/salt -d
root      81324      1  0 Jun24 ?        00:12:21 /usr/bin/python2.7 /usr/bin/salt-minion -c /etc/salt -d
nobody   122107      1  0 Jun29 ?        00:02:22 /export/servers/haproxy1.8.12/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid
root     271784     55  0 15:28 ?        00:00:00 sshd: root@pts/0 
root     271787 271784  0 15:28 pts/0    00:00:00 -bash
root     273243      1  0 16:10 ?        00:00:00 /export//servers/keepalived/sbin/keepalived -D -f /export/servers/keepalived/etc/keepalived/keepalived.conf
root     273244 273243  0 16:10 ?        00:00:00 /export//servers/keepalived/sbin/keepalived -D -f /export/servers/keepalived/etc/keepalived/keepalived.conf
root     273254 271787  0 16:10 pts/0    00:00:00 ps -ef
[root@SaltMinion2(10.182.76.78)]$keepalived:>

附件:

/etc/rc.d/init.d/keepalived

[root@SaltMinion2(10.182.76.78)]$keepalived:>more /etc/rc.d/init.d/keepalived 
#!/bin/sh
#
# Startup script for the Keepalived daemon
#
# processname: keepalived
# pidfile: /var/run/keepalived.pid
# config: /etc/keepalived/keepalived.conf
# chkconfig: - 21 79
# description: Start and stop Keepalived

# Source function library
. /etc/rc.d/init.d/functions

# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /etc/sysconfig/keepalived

RETVAL=0

prog="keepalived"

start() {
    echo -n $"Starting $prog: "
    daemon /export/servers/keepalived/sbin/keepalived ${KEEPALIVED_OPTIONS} -f /export/servers/keepalived/etc/keepalived/keepalived.conf
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}

stop() {
    echo -n $"Stopping $prog: "
    killproc keepalived
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
}

reload() {
    echo -n $"Reloading $prog: "
    killproc keepalived -1
    RETVAL=$?
    echo
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    reload)
        reload
        ;;
    restart)
        stop
        start
        ;;
    condrestart)
        if [ -f /var/lock/subsys/$prog ]; then
            stop
            start
        fi
        ;;
    status)
        status keepalived
        RETVAL=$?
        ;;
    *)
        echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
        RETVAL=1
esac

exit $RETVAL
View Code

/export/servers/keepalived/etc/keepalived/keepalived.conf 

[root@SaltMinion2(10.182.76.78)]$keepalived:>more  /export/servers/keepalived/etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
   notification_email {
     saltstack@example.com
   }
   notification_email_from keepalived@example.com
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id haproxy_ha
}
vrrp_instance haproxy_ha {
  state BACKUP #
  interface eth0
  virtual_router_id 36
  priority 100
  advert_int 1
  authentication {
    auth_type PASS
    auth_pass 1111
  }
  virtual_ipaddress {
    10.182.76.77
  }
}
View Code

 

posted @ 2018-06-29 18:17  左扬  阅读(298)  评论(0编辑  收藏  举报
levels of contents