Chinaunix首页 | 论坛 | 博客
  • 博客访问: 317308
  • 博文数量: 104
  • 博客积分: 3025
  • 博客等级: 中校
  • 技术积分: 1150
  • 用 户 组: 普通用户
  • 注册时间: 2005-02-02 11:12
文章分类

全部博文(104)

文章存档

2013年(1)

2011年(2)

2010年(30)

2009年(29)

2008年(8)

2007年(15)

2006年(17)

2005年(2)

我的朋友

分类:

2010-09-13 16:02:32

环境说明:

MASTER IP:192.168.202.16
BACKUP IP:192.168.202.17
漂移IP:   192.168.202.200

下面例子用来提供一个http服务的双机HA

#MASTER配置文件

global_defs {
   notification_email {
     
   }
   notification_email_from
   smtp_server 192.168.0.11
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state MASTER           #角色
    interface eth0         #HA监测的设备
    virtual_router_id 51   #虚拟路由ID一组集群必须设置为同一个ID
    priority 100           #权重,backup不能高于master
    advert_int 1           #检测时间间隔
    mcast_src_ip 192.168.202.16  #多播地址(自己的IP)
    authentication {
        auth_type PASS     #认证类型
        auth_pass 1111     #认证密码,设置为一致
    }
    virtual_ipaddress {
        192.168.202.200    #漂移IP,可以为多个
    }
}
virtual_server 192.168.202.200 80 {
    delay_loop 5
    lb_algo sh
    lb_kind NAT
    persistence_timeout 50
    protocol TCP
    real_server 192.168.202.16 80 {
        weight 1
        TCP_CHECK {
            connect_timeout 3
        }
    }
    real_server 192.168.202.17 80 {
        weight 1
        TCP_CHECK {
            connect_timeout 3
        }
    }
}

 

#BACKUP配置文件

global_defs {
   notification_email {
     
   }
   notification_email_from
   smtp_server 192.168.0.11
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state BACKUP          #角色
    interface eth0       #HA监测的设备
    virtual_router_id 51 #虚拟路由ID一组集群必须设置为同一个ID
    priority 90          #权重,backup不能高于master
    advert_int 1         #检测时间间隔
    mcast_src_ip 192.168.202.17 #多播地址(自己的IP)
    authentication {
        auth_type PASS   #认证类型
        auth_pass 1111   #认证密码,设置为一致
    }
    virtual_ipaddress {
        192.168.202.200  #漂移IP,可以为多个
    }
}

virtual_server 192.168.202.200 80 {
    delay_loop 5
    lb_algo sh
    lb_kind NAT
    persistence_timeout 50
    protocol TCP
    real_server 192.168.202.16 80 {
        weight 1
        TCP_CHECK {
            connect_timeout 3
        }
    }
    real_server 192.168.202.17 80 {
        weight 1
        TCP_CHECK {
            connect_timeout 3
        }
    }
}


阅读(676) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~