Two virtual servers on the same box

Frédéric Martinoty frederic.martinoty at seniorplanet.fr
Mon Mar 5 16:56:31 GMT 2007


Hello


I currently use LVS on a Linux box for an Apache cluster. My 
configuration file defines a virtual server which redirects requests 
sent on the port 80 to one of my real servers. I'd like to use LVS on 
the same box to setup a node managment for a MySQL cluster, which means 
I need to redirect requests sent on the port 3306.

Can I define two virtual servers like this ? In my idea, it should be 
something like this (see below). Do you think it is possible ? I'm 
working directly on the production server, so I can't afford to test and 
crash everything 20 times per day :-)

Thanks

Fred


Example of keepalived.conf :


virtual_server my_public_IP 80 {
    delay_loop 6
    lb_algo wlc
    lb_kind NAT
#    persistence_timeout 1
    protocol TCP

    # RIP www0
    real_server 10.0.0.1 80 {
        weight 4
        inhibit_on_failure

        TCP_CHECK {
                connect_timeout 10
                nb_get_retry 1
        }
    }

    # RIP www1
    real_server 10.0.0.2 80 {
        weight 4
        #weight 0
        inhibit_on_failure

        TCP_CHECK {
                connect_timeout 10
                nb_get_retry 1
        }
    }
}


virtual_server my_public_IP 3306 {
    delay_loop 6
    lb_algo wlc
    lb_kind NAT
#    persistence_timeout 1
    protocol TCP

    # RIP mysql0
    real_server 10.0.0.3 3306 {
        weight 4
        inhibit_on_failure

        TCP_CHECK {
                connect_timeout 10
                nb_get_retry 1
        }
    }

    # RIP mysql1
    real_server 10.0.0.4 3306 {
        weight 4
        #weight 0
        inhibit_on_failure

        TCP_CHECK {
                connect_timeout 10
                nb_get_retry 1
        }
    }
}







Search lvs-users Archives
Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort

More information about the lvs-users mailing list