shilang 发表于 2015-9-4 07:56:57

安装keepalived

  主机名网络IP                     VIP
node1    192.168.2.161   192.168.2.165
node2    192.168.2.162
  # wget http://www.keepalived.org/software/keepalived-1.2.13.tar.gz
# tar zxvf keepalived-1.2.13.tar.gz
# cd keepalived-1.2.13
# ./configure --prefix=/usr/local/keepalived --disable-fwmark
# make
# make install
# cp /usr/local/keepalived/sbin/keepalived /usr/sbin/
# cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
# cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
# cd/etc/init.d/
# chkconfig --add keepalived
# chkconfig keepalived on
# mkdir -p /etc/keepalived

#vim /etc/keepalived/keepalived.conf
  
! Configuration File for keepalived

global_defs {
   notification_email {
   gaoming@123.com
   }
   notification_email_from gaoming@123.com
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state MASTER    #备用服务器上改为 BACKUP
    interface eth1
    virtual_router_id 51
    priority 100    #备用服务器上改为99
    advert_int 1
    authentication {
      auth_type PASS
      auth_pass 1111
    }
    virtual_ipaddress {
      192.168.2.165/24 dev eth1 scope global
    }
}
# service keepalived start
Starting keepalived:                                       
# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:0c:29:c5:66:52 brd ff:ff:ff:ff:ff:ff
    inet 192.168.228.156/24 brd 192.168.228.255 scope global eth0
    inet6 fe80::20c:29ff:fec5:6652/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:0c:29:c5:66:5c brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.161/24 brd 192.168.2.255 scope global eth1
    inet 192.168.2.165/24 scope global secondary eth1
    inet6 fe80::20c:29ff:fec5:665c/64 scope link
       valid_lft forever preferred_lft forever
4: sit0: <NOARP> mtu 1480 qdisc noop
    link/sit 0.0.0.0 brd 0.0.0.0
  报错:
  
  checking for openssl/ssl.h... no
configure: error:
!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL headers files.            !!!
# yum install openssl*
  
  checking for kernel macvlan support... no
checking whether SO_MARK is declared... no
configure: error: No SO_MARK declaration in headers
# ./configure --prefix=/usr/local/keepalived --disable-fwmark
页: [1]
查看完整版本: 安装keepalived