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

Deployment and Application method of GlusterFS

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

Share

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

This article focuses on "the deployment and application of GlusterFS". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the deployment and application of GlusterFS.

1. GlusterFS installation

This blog briefly introduces the deployment and application of GlusterFS in CentOS 7. Because GlusterFS requires the use of a network, you must also set firewall rules based on the environment in advance to turn off SELinux.

Because GlusterFS requires at least two servers to build, we use two servers as examples here. The server configuration is preferably the same, with two disks for each server, one for installing the system and one for GlusterFS.

Server IP hostname system server1192.168.2.206server1.wzlinux.comCentOS 7.2server2192.168.2.207server2.wzlinux.comCentOS 7.2

1. Environment setting

Because GlusterFS has no concepts such as server and metadata, the settings for all servers are the same. The first thing to do is to set the hostname, where one server is demonstrated and the other server does the same.

# vim / etc/hostnameserver1.wzlinux.com# vim / etc/hosts192.168.2.206 server1.wzlinux.com server1192.168.2.207 server2.wzlinux.com server2

2. Clock synchronization

Another problem is that the time within the cluster is very important. if there is an error in the time between the servers, it may bring trouble to the communication between the clusters and lead to the failure of the cluster. We use the method of network synchronization clock here.

Ntpdate time.nist.gov

3. Install GlusterFS warehouse

There is a detailed installation process on CentOS's wiki, and we use CentOS 7's yum installation repository directly here.

Yum install centos-release-gluster-y

4. Format and mount bricks

Format our other disk sdb and mount it. I am configuring a disk with 20GB capacity here.

Mkfs.xfs-I size=512 / dev/sdbmkdir-p / bricks/brick1

Add the following to / etc/fstab.

/ dev/sdb / bricks/brick1 xfs defaults 1 2

And then mount it.

Mount-a

5. Install GlusterFS

Yum-enablerepo=centos-gluster*-test install glusterfs-server

Add boot startup and startup services.

Systemctl enable glusterdsystemctl start glusterd

Second, configure services and clusters

After installing GlusterFS, it cannot be used immediately, and the server needs to be configured. Before configuration, it is best to use the command ping the hostname of each server to make sure that the hostname and IP have been configured correctly.

1. Configure trusted pool

Server1:

Gluster peer probe server2

Server2:

Gluster peer probe server1

For a certain server, the local machine has been added automatically, just add other server.

View the cluster status.

# gluster peer statusNumber of Peers: 1Hostname: server2Uuid: 17c14f29-a379-45a1-b8b3-5e4c97baa643State: Peer in Cluster (Connected)

2. Configure GlusterFS volumes

Do the following on both server1 and server2.

Mkdir / bricks/brick1/gv0

You can operate the following instructions on any server. For the creation mode of the volume, you can refer to my previous blog post. Here we create a replicated volume, similar to RAID1.

Gluster volume create gv0 replica 2 server1:/bricks/brick1/gv0 server2:/bricks/brick1/gv0gluster volume start gv0

Make sure it has been started and check it on any machine.

# gluster volume info Volume Name: gv0Type: ReplicateVolume ID: 794d313e-11cc-4b72-8190-619a7583d2ffStatus: StartedSnapshot Count: 0Number of Bricks: 1 x 2 = 2Transport-type: tcpBricks:Brick1: server1:/bricks/brick1/gv0Brick2: server2:/bricks/brick1/gv0Options Reconfigured:transport.address-family: inetnfs.disable: on

3. Mount the volume

To set up to this step, we need to find a machine to mount the volume created by the test, normally we should use a third machine to mount, because we also need to configure the system and follow the additional software packages, we will take one of the server as a simple test.

Server1:

Mount-t glusterfs server1:/gv0 / mntcp / var/log/messages / mnt/

To make sure everything is all right, we look at the copied files on another machine.

Server2:

# ll / bricks/brick1/gv0/-rw-. 2 root root 304233 Jul 21 12:43 messages here, I believe you have a deeper understanding of the "deployment and application of GlusterFS", you might as well to practice it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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