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 install Glusterfs cluster in Centos7

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

In this issue, the editor will bring you about how to install Glusterfs cluster in Centos7. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

The three machines shown in the following List-1, hostname is node1/node2/node3, and then write the contents of List-1 to / etc/hosts

List-1

192.168.33.20 node1192.168.33.21 node2192.168.33.22 node3

Sources to join glusterfs

Wget-P / etc/yum.repos.d https://download.gluster.org/pub/gluster/glusterfs/LATEST/RHEL/glusterfs-rhel8.repo

Yum makecache

Install glusterfs (all three must be executed)

List-2

# install glusterfsyum install centos-release-glusteryum install-y glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma# to start gluster service systemctl start glusterd.servicesystemctl enable glusterd.service# turn off firewall systemctl stop firewalld.servicesystemctl disable firewalld.service

Execute the following List-3 on node1 to add node2 and node3 to the cluster

List-3

Gluster peer probe node2gluster peer probe node3

Check the cluster status on node1, as follows: List-4

List-4

[root@node1 db] # gluster peer statusNumber of Peers: 2Hostname: node2Uuid: ab8dac2f-e5fb-4752-b70d-b0103a40f8eaState: Peer in Cluster (Connected) Hostname: node3Uuid: f13b4732-ae12-4b6c-b4eb-65fd7886588cState: Peer in Cluster (Connected)

At this point, we can directly create the volume for use, but we want to mount the volume to the partition, so additional operations are needed. The following is List-7, the volume / dev/sdb is my new bare disk-- added through UI on virtualbox.

List-7

[root@node1 db] # fdisk-lDisk / dev/sda: 10.5 GB, 10485760000 bytes, 20480000 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x000927b6 Device Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 2047999997269768e Linux LVMDisk / dev/sdb: 3221 MB 3221225472 bytes, 6291456 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes...

The following List-8, because / dev/sdb is 3G, so I apply for 2G, and each node has to execute it.

List-8

Vgcreate vg_gluster/ dev/sdblvcreate-n lv_gluster-L 2G vg_gluster# format mkfs.ext4 / dev/vg_gluster/lv_gluster

Mount / data_gluster to the disk we created, as follows: List-9. Each node needs to execute

List-9

Echo "/ dev/vg_gluster/lv_gluster / data_gluster ext4 defaults 00" > > / etc/fstabmount-amount-l | grep gluster

Then manually create the directory / data_gluster on node1/node2/node3.

On node1, create a volume with the name db_volume with the following List-5 command

List-5

Gluster volume create db_volume\ replica 3 node1:/data_gluster/db node2:/data_gluster/db node3:/data_gluster/db force

Activate the volume, as shown in List-6

Note that it is not necessary to select a bare disk as the directory to store data

For example, there is a / opt/data directory on Linux, and the directory has enough storage to gluster volume create db_volume directly.

Replica 3 node1:/opt/data/db node2:/opt/data/db node3:/opt/data/db force

List-6

The following command gluster volume start db_volume is used in the higher version of gluster start db_volume#

At this point, although we have activated the volume, we cannot use it directly. To mount it as follows: List-10, mount the volume db_volume to the / mnt/gluster/db directory. We can only write data to / mnt/gluster/db, not directly operate / data_gluster. This step is performed on node1. You can use "umount-l / mnt/gluster/db" when you do not want to mount / mnt/gluster/db later.

List-10

Mkdir-p / mnt/gluster/dbmount-t glusterfs node1:/db_volume / mnt/gluster/db

View the version installed by glusterfs

List-11

[root@node1 vagrant] # glusterfs-- versionglusterfs 6.6Repository revision: git://git.gluster.org/glusterfs.gitCopyright (c) 2006-2016 Red Hat, Inc. GlusterFS comes with ABSOLUTELY NO WARRANTY.It is licensed to you under your choice of the GNU LesserGeneral Public License, version 3or any later version (LGPLv3or later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation.

Check the pool status of glusterfs

List-12

[root@master K8s] # gluster pool listUUID Hostname Statef1ae2684-7055-41d4-9269-669c0539b236 node1 Connected 2bf45852-d873-4910-ba20-9f8c8e68a8f6 node2 Connected bb551fbf-7dff-4c9e-9295-1d0138b84ed8 localhost Connected above is how to install Glusterfs clusters in the Centos7 shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are 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

Internet Technology

Wechat

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

12
Report