At the time of writing this documentation, the original CentOS Storage SIG repository is no longer available and the RockyLinux repository is not yet available.
However, we will use (for the time being) the archived version.
First of all, it is necessary to add the dedicated repository to gluster (in version 9) on both servers:
sudo dnf install centos-release-gluster9
Note
Later, when it is ready on the Rocky side, we can change the name of this package.
As the repo list and url is not available anymore, let's change the content of the /etc/yum.repos.d/CentOS-Gluster-9.repo:
You can let DNS handle the name resolution of the servers in your cluster, or you can choose to relieve the servers of this task by inserting records for each of them in your /etc/hosts files. This will also keep things running even during a DNS failure.
node1 $ sudo gluster peer status
Number of Peers: 1
Hostname: node2.cluster.local
Uuid: c4ff108d-0682-43b2-bc0c-311a0417fae2
State: Peer in Cluster (Connected)
Other names:
192.168.10.11
node2 $ sudo gluster peer status
Number of Peers: 1
Hostname: node1.cluster.local
Uuid: 6375e3c2-4f25-42de-bbb6-ab6a859bf55f
State: Peer in Cluster (Connected)
Other names:
192.168.10.10
We can now create a volume with 2 replicas:
$ sudo gluster volume create volume1 replica 2 node1.cluster.local:/data/glusterfs/volume1/brick0/ node2.cluster.local:/data/glusterfs/volume1/brick0/
Replica 2 volumes are prone to split-brain. Use Arbiter or Replica 3 to avoid this. See: https://docs.gluster.org/en/latest/Administrator-Guide/Split-brain-and-ways-to-deal-with-it/.
Do you still want to continue?
(y/n) y
volume create: volume1: success: please start the volume to access data
Note
As the return command says, a 2-node cluster is not the best idea in the world against split brain. But this will suffice for our test platform.
$ sudo gluster volume status
Status of volume: volume1
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick node1.cluster.local:/data/glusterfs/v
olume1/brick0 49152 0 Y 1210
Brick node2.cluster.local:/data/glusterfs/v
olume1/brick0 49152 0 Y 1135
Self-heal Daemon on localhost N/A N/A Y 1227
Self-heal Daemon on node2.cluster.local N/A N/A Y 1152
Task Status of Volume volume1
------------------------------------------------------------------------------
There are no active volume tasks
$ sudo gluster volume info
Volume Name: volume1
Type: Replicate
Volume ID: f51ca783-e815-4474-b256-3444af2c40c4
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: node1.cluster.local:/data/glusterfs/volume1/brick0
Brick2: node2.cluster.local:/data/glusterfs/volume1/brick0
Options Reconfigured:
cluster.granular-entry-heal: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
The status must be "Started".
We can already restrict access on the volume a little bit:
$ sudo gluster volume set volume1 auth.allow 192.168.10.*
There are no additional repositories to configure. The client is already present in the base repos.
Create a file and check that it is present on all the nodes of the cluster:
On client:
sudo touch /data/test
On both servers:
$ ll /data/glusterfs/volume1/brick0/
total 0
-rw-r--r--. 2 root root 0 Feb 3 19:21 test
Sounds good! But what happens if node 1 fails? It is the one that was specified when mounting the remote access.
Let's stop node one:
$ sudo shutdown -h now
Check status on node2:
$ sudo gluster peer status
Number of Peers: 1
Hostname: node1.cluster.local
Uuid: 6375e3c2-4f25-42de-bbb6-ab6a859bf55f
State: Peer in Cluster (Disconnected)
Other names:
192.168.10.10
[antoine@node2 ~]$ sudo gluster volume status
Status of volume: volume1
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick node2.cluster.local:/data/glusterfs/v
olume1/brick0 49152 0 Y 1135
Self-heal Daemon on localhost N/A N/A Y 1152
Task Status of Volume volume1
------------------------------------------------------------------------------
There are no active volume tasks
While there are no current repositories, using the archived repositories that CentOS had for GlusterFS will still work. As outlined, GlusterFS is pretty easy to install and maintain. Using the command line tools is a pretty straight forward process. GlusterFS will help create and maintain high-availability clusters for data storage and redundancy. You can find more information on GlusterFS and tool usage from the official documentation pages.