Chinaunix

标题: 关于keepalived的问题,可以同时监控80和3306端口吗 [打印本页]

作者: onlyword    时间: 2008-12-16 18:25
标题: 关于keepalived的问题,可以同时监控80和3306端口吗
各位好,因为最近的项目,LVS的服务器基本搭完了,多亏坛子里面的各位热心帮忙。
现在出现了个小问题,是关于LVS备份机和,真实机的健康检查的。
我是用的Keepalived,之前我配置的单独监控80网站或者3306数据库的时候都可以做到负载均衡,
但是把这俩和起来的时候却哪个都不行了,到底是哪里出了问题呢。谁能给我个建议么?

以下是我的配置文件


# Configuration File for keepalived
global_defs {
    notification_email {
        xxxxxxx
    }
    notification_email_from xxxxxxx
    smtp_server xxxxxxxx
    smtp_connect_timeout 30
    lvs_id LVS_ONE
}

vrrp_sync_group VG1 {
    VI_1
}

vrrp_sync_group VG2 {
    VI_2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    lvs_sync_daemon_interface eth0
    virtual_router_id 1
        priority 101
        advert_int 1
        authentication {
        auth_type PASS
        auth_pass mysqlcluster
        }
    virtual_ipaddress {
        192.168.1.124
        }
}

vrrp_instance VI_2 {
    state MASTER
    interface eth0
    lvs_sync_daemon_interface eth0
    virtual_router_id 2
    priority 101
        advert_int 1
        authentication {
        auth_type PASS
        auth_pass 1111
        }
    virtual_ipaddress {
        192.168.1.123
        }
}


virtual_server 192.168.1.124 3306 { (此处定义负载均衡部分,使用DR方式)
     delay_loop 6
    lvs_sched wlc
    lvs_method DR
    persistence_timeout 60
    ha_suspend
    protocol TCP
    real_server 192.168.1.36 3306 {
        weight 1
        TCP_CHECK {
                  connect_timeout 10
        }
    }
    real_server 192.168.1.245 3306 {
        weight 1
        TCP_CHECK {
                  connect_timeout 10
        }
    }
    real_server 192.168.1.37 3306 {
        weight 1
        TCP_CHECK {
                 connect_timeout 10
        }
    }
}

virtual_server 192.168.1.123 80 {
     delay_loop 6
    lvs_sched wlc
    lvs_method DR
    persistence_timeout 60
    ha_suspend
    protocol TCP
    real_server 192.168.1.237 80 {
        weight 1
        TCP_CHECK {
                  connect_timeout 10
        }
    }
    real_server 192.168.1.245 80 {
        weight 1
        TCP_CHECK {
                  connect_timeout 10
        }
    }
}
作者: kns1024wh    时间: 2008-12-16 21:42
标题: 回复 #1 onlyword 的帖子
你的错误提示是什么,或者是ipvsadm的调度信息
作者: onlyword    时间: 2008-12-17 11:12
也没报错。
就是以前单开的时候,访问VIP就直接做负载了,现在访问VIP都访问不到,网页显示不出来,数据库连接不上。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2