DEV Community

Cover image for Gluster FileSystem - One Click Install
Anuvindh Sankaravilasam for AWS Community Builders

Posted on • Updated on

Gluster FileSystem - One Click Install

DAY 4 - GlusterFS on Cloud

☁️100 days of Cloud- Day Four
Follow Me on Twitter

cover

Tweet This Blog - Read on GitHub - read iCTPro.co.nz

What is Gluster File System

GlusterFS (Gluster File System) is an open source Distributed File System that can scale out in building-block fashion to store multiple petabytes of data.

Use Cases

streaming media , content delivery. Scale-out storage systems based on GlusterFS are suitable for unstructured data such as documents, images, audio and video files, and log files.

Prerequisite

  • Minimum Three VM,For this demo we deploy it in AWS EC2.
  • git on VM's Make sure EC2/VM have git installed To check
 git --version
Enter fullscreen mode Exit fullscreen mode

To install git

  sudo apt install git-all
Enter fullscreen mode Exit fullscreen mode
  • Open ports on Security Groups

Security Group For GFS

Type Protocol Ports Source Description
SSH SSH 22 Administration Host Security Group Administration Host Security Group
Custom TCP Rule TCP 2007 GlusterFS Security Group Secure Transport Server Security Group Gluster Daemon
Custom TCP Rule TCP 111 GlusterFS Security Group SecureTransport Server Security Group Portmapper
Custom TCP Rule TCP 49152-49251 GlusterFS Security Group SecureTransport Server Security Group Each brick for every volume on your host requires its own port
Custom TCP Rule TCP 2049 GlusterFS Security Group SecureTransport Server Security Group NFS

Tutorial

In this tutorial
Code Repo - github

  • I will launching three ubuntu ec2 instance install.
  • Install Gluster FS.
  • Peer Servers.
  • Create Gluster Volume.
  • Test the replication.

If you dont know how to launch ec2 , use this link

Step 1

  • launching ec2 , am using Ubuntu Server 20.04 LTS . Also make sure you enable Auto-assign Public IP .
  • Am naming three servers as MasterNode , GlusterFS-01, GlusterFS-01, easy for understanding.
  • Note down public IP for MasterNode , GlusterFS-01, GlusterFS-01

Step 2

  • First SSH into GlusterFS-01. Get root privilages to run command
sudo su -
Enter fullscreen mode Exit fullscreen mode
wget https://raw.githubusercontent.com/anuvindhs/How-to-install-GlusterFS/main/install.sh
Enter fullscreen mode Exit fullscreen mode
chmod u+x install.sh
Enter fullscreen mode Exit fullscreen mode
./install.sh
Enter fullscreen mode Exit fullscreen mode

install sh

Info Screenshots
Enter your Server Name ServerName
System will Automatically Update Ubuntu OS update
Installing GlusterFS and Dependencies , once installed restart the servers GFS
If you wish to see the installation data debug
  • Do this for GlusterFS-02 and MasterNode

Now you have success fully installed GlusterFS

Peering GlusterFS 🤝🏼

This is really important , we need to configure the hostname for all three servers

On each server type

sudo nano /etc/hosts/
Enter fullscreen mode Exit fullscreen mode
Nodes /etc/hosts data
MasterNode msnode
GlusterFS-01 gfs01
GlusterFS-02 Image description

MasterNode
52.62.40.54 MasterNode
54.252.253.181 GlusterFS-01
13.236.188.52 GlusterFS-02
GlusterFS-01
127.0.0.1 GlusterFS-01
52.62.40.54 MasterNode
13.236.188.52 GlusterFS-02
GlusterFS-02
52.62.40.54 MasterNode
54.252.253.181 GlusterFS-01
13.236.188.52 GlusterFS-02

make sure you add your public ip

now lets ping all nodes from all servers
ping Masternode
ping GlusterFs-01
ping GlusterFS-02

if all servers pings successfully, we are going to peer the servers now

Go to Masternode

gluster peer probe GlusterFS-01
gluster peer probe GlusterFS-02
Enter fullscreen mode Exit fullscreen mode

peer

Creating Gluster Volume 💽

On Masternode

sudo gluster volume create gv0 replica 3 transport tcp Masternode:/glusterfs glusterfs-01:/glusterfs glusterfs-02:/glusterfs force
Enter fullscreen mode Exit fullscreen mode
sudo gluster volume start gv0
Enter fullscreen mode Exit fullscreen mode

Congratulations 🎉 you have successfully configured the GlusterFS

Testing Gluster-FS replication

lets check the gluster volume info

Volume info

Create folder for replication test 📁

sudo mkdir -p /myfiles
Enter fullscreen mode Exit fullscreen mode

Mount the /GlusterFS to /myfiles Folder

sudo mount -t glusterfs Masternode:/glusterfs /myfiles
cd /myfiles
sudo touch file_{0..9}.test
ls /glusterfs
Enter fullscreen mode Exit fullscreen mode

You will be able to see the replicated files on each server

Discussion (0)