Loadbalancing mysql with heartbeat not working

Discussion in 'Server Operation' started by mapcorp, Jun 29, 2009.

  1. mapcorp

    mapcorp New Member

    Hi,
    I'm totally new with loadbalancing so please I need a bit of help.

    Here's my scenario:
    1 loadbalancer (lbsql1 192.168.0.7)
    4 mysql server (192.168.0.51 -> 54)

    Here's my config files:

    lbsql1:~ # cat /etc/ha.d/ha.cf
    logfacility local0
    bcast
    mcast eth0 225.0.0.1 694 1 0
    auto_failback off
    node lbsql1
    respawn hacluster /usr/lib64/heartbeat/ipfail
    apiauth ipfail gid=haclient uid=hacluster


    lbsql1:~ # cat /etc/ha.d/haresources
    lbsql1 ldirectord::ldirectord.cf LVSSyncDaemonSwap::master IPaddr2::192.168.0.7/24/eth0/192.168.0.255


    lbsql1:~ # cat /etc/ha.d/authkeys
    auth 3
    3 md5 mypassword


    lbsql1:~ # cat /etc/ha.d/ldirectord.cf
    # Global Directives
    checktimeout=10
    checkinterval=2
    autoreload=no
    logfile="local0"
    quiescent=yes
    virtual=192.168.0.7:3306
    service=mysqld
    real=192.168.0.51:3306 gate
    real=192.168.0.52:3306 gate
    real=192.168.0.53:3306 gate
    real=192.168.0.54:3306 gate
    checktype=negotiate
    login="ldirector"
    passwd="ldirector"
    database="ldirectordb"
    request="SELECT * FROM connectioncheck"
    scheduler=wrr



    When I try to connect from my application it fails...
    How can I track the problem?

    Thanks
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What are the outputs of
    Code:
    netstat -tap
    and
    Code:
    ifconfig
    on the load balancer? Any errors in the logs?
     
  3. mapcorp

    mapcorp New Member

    when I start heartbeat shows me some warnings....but it starts
    lbsql1:~ # /etc/init.d/heartbeat start
    Starting High-Availability serviceslogd is already running
    /etc/init.d/heartbeat: line 142: /usr/lib64/heartbeat/ResourceManager: No such file or directory
    heartbeat: baudrate setting must precede media statementsheartbeat[8443]: 2009/01/14_14:33:00 WARN: Core dumps could be lost if multiple dumps occur.
    heartbeat[8443]: 2009/01/14_14:33:00 WARN: Consider setting non-default value in /proc/sys/kernel/core_pattern (or equivalent) for maximum supportability
    heartbeat[8443]: 2009/01/14_14:33:00 WARN: Consider setting /proc/sys/kernel/core_uses_pid (or equivalent) to 1 for maximum supportability
    heartbeat[8443]: 2009/01/14_14:33:00 info: Version 2 support: false
    heartbeat[8443]: 2009/01/14_14:33:00 WARN: Logging daemon is disabled --enabling logging daemon is recommended
    heartbeat[8443]: 2009/01/14_14:33:00 info: **************************
    heartbeat[8443]: 2009/01/14_14:33:00 info: Configuration validated. Starting heartbeat 2.99.4
    done


    however seems not listening at port 3306

    lbsql1:~ # netstat -tap
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 *:sunrpc *:* LISTEN 2270/rpcbind
    tcp 0 0 *:ssh *:* LISTEN 2800/sshd
    tcp 0 0 localhost:smtp *:* LISTEN 2763/master
    tcp 0 0 lbsql1:ssh 192.168.0.18:39565 ESTABLISHED 8392/1
    tcp 0 0 *:sunrpc *:* LISTEN 2270/rpcbind
    tcp 0 0 *:ssh *:* LISTEN 2800/sshd


    lbsql1:~ # ifconfig
    eth0 Link encap:Ethernet HWaddr 00:0C:29:02:A0:AD
    inet addr:192.168.0.7 Bcast:192.168.0.255 Mask:255.255.255.0
    inet6 addr: fe80::20c:29ff:fe02:a0ad/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:27698 errors:0 dropped:0 overruns:0 frame:0
    TX packets:10667 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:8036039 (7.6 Mb) TX bytes:2501689 (2.3 Mb)

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:10 errors:0 dropped:0 overruns:0 frame:0
    TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:772 (772.0 b) TX bytes:772 (772.0 b)
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Is 192.168.0.7 the regular IP address of the load balancer? The virtual IP must be an additional IP, i.e., the load balancer's main IP should be different.
     
  5. mapcorp

    mapcorp New Member

    Yes 192.168.0.7 is the regular and physical IP for the load balancer..Do I need a Virtual IP even when there's only 1 machine acting as loadbalancer?
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Yes, please use a virtual IP.
     

Share This Page