In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how to use Linux and GFS to create cluster storage, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.
Load balancing is a difficult task. We often need to share the file system by providing a central address for the data through NFS (Network File system) or other mechanisms. Although your security mechanism may protect you from Web server node failures, you still need to share data through a central storage node.
With GFS (Global File system), a free cluster file system for Linux, you can create a truly stable cluster that does not need to rely on other servers. In this article, we will show you how to set up GFS.
Conceptually, a cluster file system allows 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 OCFS (Oracle Cluster File system) and Linux's GFS.
There are many ways for a block device to be used by multiple servers at the same time. You can partition a SAN (storage area network) LUN (logical unit number) that is visible to multiple servers, set the corresponding iSCSI (Internet minicomputer system interface), or use DRBD (distributed replication block device) to copy a partition between two servers. When using DRBD, you will need to set up DRBD in the master / master node to use GFS.
GFS requirements
Running GFS means you are running a cluster. By far, the easiest way to run GFS is to use Red Hat Cluster Suite (RHCS:Red Hat Cluster Suite). This suite is available in CentOS. In addition, the following packages are needed: cman-- cluster manager; lvm2-cluster-- enables LVM (logical volume manager) to support the cluster's CLVM (cluster logical volume manager) package; kmod-gfs--GFS kernel module; and finally, gfs-utils.
The cluster manager (cman) contains the necessary tools, such as a distributed lock manager. Unless you want to take the time to confirm how different distributions use cman, we highly recommend using CentOS or RHEL. At the same time, you will also get the latest versions of cluster services maintained by RH (Red Hat). In addition, you can also get a relatively stable environment.
The Fencing mechanism is absolutely necessary. Some guidance articles recommend setting the block mode to "manual" because the block setting can be complex. Blocking means isolating in the cluster or interrupting the operation of some dangerous nodes immediately. If the cluster cannot block a failed node, there will be a lot of problems with your GFS, so don't skip this step.
Create cluster settings
You can do most of the cluster setup through the cluster.conf in / etc/cluster/. I do not recommend using various cluster management applications to create this settings file. Even fully supported RHEL applications, such as Conga released two months ago, often create invalid cluster.conf files that cannot be parsed by the necessary services.
The following is an example of a cluster.conf file. This settings file is in a beautiful XML format and its content is very straightforward. First, we name the cluster, which we call Web.1.
Skip the fence daemon option first, and the next part is the setting content of the cluster body. You need to define two nodes in the clusternodes section. The settings file will be stored on both nodes at the same time so that both nodes know about each other.
Each node in the cluster declares that the name of its blocking method is unique. Under the clusternames closing tag, we see that the fencedevice section defines how each node blocks the other nodes. Using a server that supports IPMI (Intelligent platform Management Interface) is the best way, and its setup is quite simple. All you have to do is tell IP where IPMI is and how to log in. To avoid leaving a password in cluster.conf, you can point it to a script owned by the root and let the script return the password.
We would also like to point out that we have defined two nodes in the setup. This is necessary because, in general, the cluster cannot reach the "Quorate" state unless most nodes agree to their own state. If there are only two nodes, there is no definite majority, so this approach allows the cluster to work under two nodes, not 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 start to function properly. You can check "clustat" or "cman nodes" to make sure the node is working well. If any of the necessary parts are not started, the cluster will not display a "Quorate" status.
GFS Settin
First, we need to set up CLVM so that we can use LVM through GFS. To activate CLVM, just set "locking type=3" in lvm.conf.
Then, create a LVM volume group and volume as usual, but using a shared block device. If you are using DRBD, you will probably use / dev/drbd0. I created a physical volume, then a volume group named vg01, and then a logical volume named web1, which is located at: / dev/vg01/web1.
Finally, we need to create a file system:
Gfs_mkfs-t web1:mygfs-p lock_dlm-j 2 / dev/vg01/web1
The name given in-t must be the name of the cluster, followed by the name you gave to the file system. Only members of the web1 cluster can mount this file system. Then, set the key type of the distributed lock manager to indicate that you need two journal (because this is a two-node cluster). If you expect to add more nodes in the future, you need to set a high enough number of journal at this time.
Summary
We can start using this file system now. Start the "clvmd" and "gfs" services on both nodes. You can now load the file system by specifying the type as GFS through "- t gfs".
Before starting, be sure to set up the cman,clvmd and gfs services. You'd better be familiar with the clustat and gfs_tool commands, because you can use these commands to find out what the problem is when there is a problem with the system.
Don't expect GFS to be quick. If a node is doing a lot of writes, it is normal to have a pause when accessing the file system. This is not a problem for a Web cluster where there are much more data reads than writes. If there is a significant delay, first check the health of all components, and then evaluate the data being written. The most common measure to prevent latency is to ensure that the data in the HTTP conversation is not written to the GFS volume.
So much for sharing about how to use Linux and GFS to build cluster storage. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.