Server Load balancer is a difficult task. We often need to use NFS network file systems) or other mechanisms to provide a central address for data to share the file system. Although your security mechanism may protect you from faults on Web server nodes, you still need to share data through central storage nodes.
GFS Global File System) -- A free Cluster File System in Linux -- you can create a truly stable cluster without relying on other servers. In this article, we will show you how to correctly set GFS.
In terms of concept, a cluster file system can allow multiple operating systems to load the same file system and write data to the same file system at the same time. There are many cluster file systems, including Sun's Lustre, Oracle's OCFSOracle cluster file system), and Linux's GFS.
There are many ways to make a block device be used by multiple servers at the same time. You can partition a logical unit number (LUN) that is visible to multiple servers in the SAN storage LAN) and set the corresponding iSCSI Internet small computer system interface ), or use a DRBD distributed replication block device to copy a partition between two servers. When using DRBD, you need to set DRBD in the master/master node to use GFS.
GFS requirements
Running GFS means you are running a cluster. So far, the simplest way to run GFS is to use Red Hat Cluster SuiteRHCS: Red Hat Cluster suite ). This suite is available in CentOS. In addition, the following packages are required: cman -- Cluster Manager; lvm2-cluster -- enables LVM logical volume manager) to support the CLVM cluster logical volume manager package of the cluster; kmod-gfs -- GFS kernel module; finally gfs-utils.
Cluster Manager cman) contains necessary tools, such as the distributed lock manager. Unless you want to spend time figuring out how different distribution versions use cman, we strongly recommend CentOS or RHEL. at the same time, you will also get the latest version of cluster Services maintained by RHRed Hat. In addition, you can also get a stable environment.
Fencing is absolutely necessary. In some guiding articles, we recommend that you set the blocking mode to "Manual", because the blocking setting may be complicated. Blocking means isolating the cluster or immediately interrupting the operation of some dangerous nodes. If the cluster cannot block a faulty node, your GFS will have many problems, so do not skip this step.
Create cluster settings
You can complete most cluster settings through cluster. conf in/etc/cluster. I do not recommend using various cluster management applications to create this setting file. Even a fully supported RHEL application, such as Conga released two months ago, often creates invalid cluster. conf files and cannot be parsed by necessary services.
The following is an example of a cluster. conf file. This setting file adopts a beautiful XML format, and its content is very direct. First, we name the cluster. We call this cluster "Web.1 ".
Skip the fence daemon option first. The next part is the setting content of the cluster body. You need to define two nodes in the noternodes section. The setting file will be stored on both nodes at the same time, so that both nodes know each other.
Each node in the cluster declares that the name of the blocking method is unique. Under the ternames end tag, the fencedevice section defines how each node blocks other nodes. Using a server that supports the IPMI smart platform management interface) is the best method, and its configuration is quite simple. You only need to tell the IP address of IPMI and the logon method. To avoid leaving a password in cluster. conf, you can point it to a script owned by the root and return the password by this script.
We also need to point out that we have defined two nodes in the settings. This is required because the cluster cannot reach the "Quorate" State unless most nodes agree to their own state. If there are only two nodes, there is not a majority. Therefore, this method allows the cluster to work only under two nodes, rather than only one node. This is a necessary way to set up a basic cluster.
Run "service cman start" on each node, and the system should be able to start normal operation. You can check "clustat" or "cman nodes" to check whether the node is running well. If any necessary part is not started, the cluster will not display the "Quorate" status.