2010/7/5 Torintino T <torintino2 at live.com>: > > Dear All, > > I am newbie to Linux Clustering, i have 2 standalone CentOS servers, i want > to setup a cluster on those servers, > to synchronize between each other, and to make a one as standby to the > other, if a one fails the other will switchover. > > I will mostly use Apache, Mysql, and PHP. > > I have read the "Cluster Administration" document, i found that there are > multiple methods to setup the cluster, > actually i want to ask expert people in the clustering, which method is the > most proper one, > and should i have use a fence device, which one i will preferably use. There are several options depending on your requirements and your resources. For synchronizing the web root, you can opt for something as simple as rsync or checkout from a central repository. For mysql, there are some creative methods including fully clustered mysql servers ($$), dump/restore from primary to secondary. If you opt for shared storage there are a few other options but it requires a little more complex setup. Easiest situation is a SAN volume that you can swing from node1 to node2. This can be backed by an actual SAN, by a Linux host running iSCSI services, DRBD, GNBD, etc.. Shared storage requires fencing, either through the "standard" mechanisms or via logic on the application side. If you just have two nodes and no central storage, IMHO the easiest setup would be a DRBD volume. Use luci to build the cluster with a virtual IP that swings between the two nodes. This is rather simple: Install drbd, luci, ricci. Configure the drbd volumes between the two nodes. Ample documentation is available and the process is fairly trivial. If at all possible, build a second network for this traffic. Configure clustering, using luci, on the first node. At minimum you'd setup a parent service with some child services of the web root and mysql database mount, virtual IP, and the actual httpd/mysql services. For people new to CentOS clustering, this can be a little confusing as the cluster "service" you setup initially is not just a network service such as apache, dns, etc., but an application. The application then has dependent "services" which can include a filesystem, ip address, daemons, etc.. Note that "exclusive" doesn't mean a service runs on just one node, but that *only* that service runs on a node. If you set a service as exclusive, unless you have a separate node for each exclusive service, you may run intro frustration when you try to failover nodes. Configure your fencing. At simplest case you can configure a policy that will, in essence say "Die!" to the other node. If the other node doesn't die, the active node can kill the other node in various and sundry ways including pulling the power, shutting down the node via the virtual machine host, etc.. You can also be a bit more polite and install GFS and let the GFS service handle who gets the resources. The tradeoff is in complexity. Once it's configured on the first node, import the luci configuration onto the second node.