How To Install GlusterFS on Rocky Linux 9
In this tutorial, we will show you how to install GlusterFS on Rocky Linux 9. For those of you who didn’t know, In the ever-expanding digital landscape, data management has become a crucial aspect of modern businesses and enterprises. Managing massive amounts of data efficiently, ensuring high availability, and scalability are paramount for seamless operations. GlusterFS, an open-source, distributed file system, offers an ingenious solution to these challenges.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the GlusterFS on Rocky Linux 9 or RHEL-based.
Prerequisites
- A server running one of the following operating systems: Rocky Linux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for GlusterFS.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install GlusterFS on Rocky Linux 9
Step 1. Before proceeding with GlusterFS installation, update and upgrade your Rocky Linux system to the latest packages. This ensures security fixes and the latest software versions are installed:
sudo dnf update
Step 2. Installing GlusterFS on Rocky Linux 9.
As GlusterFS is not included in the default Rocky Linux repositories, we need to add the GlusterFS repository to access the required packages:
sudo dnf install https://download.gluster.org/pub/gluster/glusterfs/LATEST/Rocky/glusterfs-epel.repo
Now that we have added the repository, let’s install the GlusterFS packages on each node:
sudo dnf install glusterfs-server glusterfs-client
After GlusterFS is installed, run the systemctl
command below to start and enable the GlusterFS service:
sudo systemctl enable glusterfsd.service sudo systemctl start glusterfsd.service
Step 3. Configure Firewall.
By default, the GlusterFS server uses the following ports:
- 24007: GlusterFS daemon
- 24008: GlusterFS management
- 49152-49251: GlusterFS brick
You need to allow these ports in your firewall to enable GlusterFS communication. You can do this by running the following commands:
sudo firewall-cmd --add-port=24007/tcp --permanent sudo firewall-cmd --add-port=24008/tcp --permanent sudo firewall-cmd --add-port=49152-49251/tcp --permanent sudo firewall-cmd --reload
Step 4. Establishing Peer Connections.
Before creating a GlusterFS volume, we need to establish peer connections between the nodes. This allows them to communicate and synchronize data:
- On Server A (first node):
sudo gluster peer probe <IP_Address_of_Server_B>
Replace <IP_Address_of_Server_B>
with the IP address of the second server (Server B).
Verify Peer Status:
sudo gluster peer status
Step 5. Creating the GlusterFS Distributed Volume.
Now that the peer connections are established, let’s create a distributed GlusterFS volume that spans across both nodes.
- Prepare the Directory for the Volume:
Choose a directory on each server that you want to use as part of the GlusterFS volume. For this example, we will create a directory named “gluster_data
” on both nodes.
On Server A:
sudo mkdir /data/glusterfs
On Server B:
sudo mkdir /data/glusterfs
- Create the Distributed Volume:
On Server A, execute the following command to create a distributed GlusterFS volume named “myvolume
” with two replicas (one on each node):
sudo gluster volume create myvolume replica 2 transport tcp <IP_Address_of_Server_A>:/data/glusterfs <IP_Address_of_Server_B>:/data/glusterfs force
Replace <IP_Address_of_Server_A>
and <IP_Address_of_Server_B>
with the respective IP addresses of Server A and Server B.
- Starting the GlusterFS Volume:
Start the newly created GlusterFS volume to make it available for use:
sudo gluster volume start myvolume
Step 6. Verifying the GlusterFS Volume.
After creating the distributed volume, we should verify its status to ensure successful creation.
- Verify Volume Information:
Check the details of the GlusterFS volume:
sudo gluster volume info
- Checking Volume Status:
Ensure that the volume status is “Started” on both nodes:
sudo gluster volume status
Step 7. Mounting the GlusterFS Volume.
To access the GlusterFS volume from client machines, you need to mount it in the desired directory.
- Create the Mount Point:
On the client machine, create a directory that will serve as the mount point. For example, we will use "/mnt/glusterfs
“:
sudo mkdir /mnt/glusterfs
- Mount the GlusterFS Volume:
Mount the GlusterFS volume from the client machine using the following command:
sudo mount -t glusterfs <IP_Address_of_Server_A>:/myvolume /mnt/glusterfs
Replace <IP_Address_of_Server_A>
with the IP address of any node from the GlusterFS cluster.
Step 8. Troubleshooting GlusterFS Issues.
Despite a careful installation process, you may encounter some challenges when setting up GlusterFS. Here are a few common issues and their solutions:
-
Peer Connection Failed: If the peer probe fails, ensure that both servers can communicate over the network. Check for any network-related issues, firewall settings, or incorrect IP addresses.
-
Volume Creation Errors: If volume creation fails, review the command syntax and ensure that the directories and IP addresses are correct.
-
Volume Start Issues: If the volume fails to start, verify that the peer connections are established correctly and that there are no storage-related problems on the nodes.
Congratulations! You have successfully installed GlusterFS. Thanks for using this tutorial for installing the GlusterFS on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official GlusterFS website.