yunvn 发表于 2017-4-17 22:30:49

HA keepalived CENTOS6.3

  安装
  #yum install gcc openssl openssl-devel popt-devel make
  #wget http://www.keepalived.org/software/keepalived-1.2.7.tar.gz
  #gunzip keepalived-1.2.7.tar.gz
  #tar xvf keepalived-1.2.7.tar
  #cd keepalived-1.2.7
  #./configure
  #make && make install
  #cp /usr/local/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
  #cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
  #mkdir /etc/keepalived
  #cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/
  #cp /usr/local/sbin/keepalived /usr/sbin/
  #vi /etc/rc.d/rc.local
  /etc/init.d/keepalived start         //增加开机自启动
  #service keepalived start
  端口是121 修改iptables selinux
  -----------------------------------------------------------------------------------------------------------------------------------------------------
  主备机器可以一样配置
  vi /etc/keepalived/keepalived.conf
  global_defs {
  router_id HA_1
  }
  vrrp_script chk_sentiment_port{
  script "/tcp/192.168.154.201/19145"
  //监听192.168.154.201:19145的服务,如果挂掉了就按权责补上来
  intetval 1
  weight -30
  }
  vrrp_instance VI_1 {
  state MASTER
  interface eth0
  virtual_router_id 1
  priority 100
  advert_int 1
  authentication {
  auth_type PASS
  auth_pass 1111
  }
  virtual_ipaddress {
  192.168.154.203
  }
  track script{
  chk_sentiment_port
  }
  }
  ----------------------------------------------------------------------------------------------------------------------------------------------------
  测试正常
页: [1]
查看完整版本: HA keepalived CENTOS6.3