Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make use of Linux and GFS to build Cluster Storage

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use Linux and GFS to build cluster storage, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

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 * * is 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 various 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 *. 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 an easy way to set up. 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.

*, 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.

The above is all the contents of the article "how to use Linux and GFS to build cluster storage". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report