On June 13th, YesGood wrote: > Hi, > How I can configure load balancing Database cluster with the LVS.? > I use keepalived, and I have one configuration for the load balancer for > the web server, but I don't know how work for the database. > > with what port I work?
This depends on your specific database server and install. For example, MySQL per default runs on port 3306, but may be run on any arbitary port. Please note in general, your specific application has to be fine with being load balanced, as LVS only balances on the network level. LVS doesn't inspect your IP packets or tcp connections and can't e.g. tell "read" from "write" requests, accordingly route them to different nodes or clusters. LVS also doesn't synchronize data between your database servers - that's the job of your DBMS. Actually, there aren't many DBMS who do permit loadbalanced database connections, and some of them do implement loadbalancing on a different level, yet others may be "mis-used" for loadbalancing. For example, I'm running a MySQL "write master", whose data is being replicated onto a few dozen different MySQL servers. Those replicas are being run in "read-only" mode, and a LVS loadbalancer balances incoming connections among those read-only-nodes. The usecase scenarios are the following: -any application who writes data, does connect to the "write master". -any application who absolutely requires consistent data does connect to the "write master" as well. -any application, who is fine with only reading data, and this data may be off by a few seconds, does connect to the read-only-cluster. > how health check to monitor the real servers? keepalived has a "check_misc"-Command for health checks; you may add a small, shortrunning skript (shell/perl/python/whatever) to test the availability of your database servers that way: connect to the database, optionally do run some small availibility test, disconnect from the database, return 0 for success and any other return code for failure. As a starting point, you may e.g. use the nagios-plugins; they do connect to various database systems and already do implement this "returncode-interface". Anders -- 1&1 Internet AG Expert Systems Architect (IT Operations) Brauerstrasse 50 v://49.721.91374.0 D-76135 Karlsruhe f://49.721.91374.225 Amtsgericht Montabaur HRB 6484 Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Robert Hoffmann, Andreas Hofmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver Mauss, Jan Oetjen Aufsichtsratsvorsitzender: Michael Scheeren _______________________________________________ Please read the documentation before posting - it's available at: http://www.linuxvirtualserver.org/ LinuxVirtualServer.org mailing list - [email protected] Send requests to [email protected] or go to http://lists.graemef.net/mailman/listinfo/lvs-users
