Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, 11 April 2019

How To Configure GlusterFS on Ubuntu 16.04

GlusterFS_Cluster




Introduction:


-- GlusterFS is a free, open source and scalable network filesystem specially designed for 
data-intensive tasks such as cloud storage and media streaming. GlusterFS made up of two 
components a server and a client. The server runs glusterfsd and the client used to mount the
exported filesystem. You can achieve high availability by distributing the data across the multiple 
volumes/nodes using GlusterFS. GlusterFS client can access the storage like local storage. GlusterFS is a file-based scale-out storage that allows you to combine large numbers of 
commodity storage and compute resources into a high performance and virtualized pool. 
You can scale both capacity and performance on demand from terabytes to petabytes.

Requirements:

1. Two AWS EC2 instance for GlusterFS server with Ubuntu 16.04 and 20 GB external 
HDD on each. 
2. One AWS EC2 instance for GlusterFS client with Ubuntu 16.04 installed.
3. A static IP address 172.31.85.78 on glusterfs1 172.31.83.5 on glusterf2 and 172.31.82.27 

on glusterclient client is configured.

Note: On security group of all instances we need to allow the ports 111,24007,24008,
38465 to 38467,49152 to 49154,All ICMP port.


Installation Process of GlusterFS Servers:


Step: 1. Update your base system with the latest available packages :

# apt-get -y update

Step: 2. Login to the GlusterFS Servers & set the hostnames as glusterfs1 & glusterfs2 :

# hostname glusterfs1
# hostname glusterfs2

# vi /etc/hostname

glusterfs1

-- Save & Quit (:wq)

Step: 3. Configure Hostname Resolution:

# vi /etc/hosts

-- Add the following lines:

172.31.83.5 glusterfs2
172.31.85.78 glusterfs1

-- Save & Quit (:wq)

Step: 4. Install GlusterFS on Server1 & Server2:

# apt-get -y install apt-transport-https
# add-apt-repository -y ppa:gluster/glusterfs-4.1
# apt-get update -y
# apt-get -y install glusterfs-server
# systemctl enable glusterd.service
# systemctl start glusterd.service

Note: If facing any issue while adding GlusterFS Repository then do the following:

# vi /usr/bin/add-apt-repository

-- Change package header from `python3` to `python3.5` (or lower)

-- Save & Quit (:wq)

Step 5. Configure GlusterFS Storage:

# mkdir -p /gshare

Next, create a persistent mount point by editing /etc/fstab file:

# vi /etc/fstab

-- Add the following line:

/dev/xvdb /gshare ext4 defaults 0 0

-- Save & Quit (:wq)

# mount -a

Step: 6. Configure GlusterFS Storage Pool:

-- Run this command on GlusterFS Server 1:

# gluster peer probe glusterfs2
# gluster volume create gdata replica 2 glusterfs1:/gshare glusterfs2:/gshare force

-- You can verify the status of the trusted storage pool with the following command Output should
be like this peer probe: success.

#  gluster peer status

Step: 7. Configure GlusterFS Volume:

# gluster volume create gdata replica 2 glusterfs1:/gshare glusterfs2:/gshare force
# gluster volume start gdata

-- Checking the volume status on both server:

# gluster volume status

-- You can now check the status of created volume with the following command:

# gluster volume info gdata

Installation Process of GlusterFS Client:


Step: 1. Update your base system with the latest available packages:

# apt-get -y update

Step: 2. Login to the client and set the hostnames:

# hostname glusterclient

# vi /etc/hostname

glusterclient

-- Save & Quit (:wq)

Step: 3. Configure Hostname Resolution:

# vi /etc/hosts

-- Add the following lines:

172.31.83.5 glusterfs2
172.31.85.78 glusterfs1
172.31.82.27 glusterclient

-- Save & Quit (:wq)

ping glusterfs1
ping glusterfs2
ping glusterclient

Step: 4. Install GlusterFS Client:

# apt-get install apt-transport-https -y
# add-apt-repository ppa:gluster/glusterfs-4.1
# apt-get -y update

# apt-get -y install glusterfs-client

Note: If facing any issue while adding GlusterFS Repository the do the following:

# vi /usr/bin/add-apt-repository

-- Change package header from `python3` to `python3.5` (or lower)

-- Save & Quit (:wq)

Step 5. Create a directory to mount GlusterFS filesystem:

# mkdir /storage-pool

-- Create a persistent mount point by editing fstab file:

# vi /etc/fstab file

glusterfs2:/gdata /storage-pool glusterfs defaults,_netdev 0 0

-- Save & Quit (:wq)

# mount -a

-- Testing the Replication Features:

On our client machine (glusterclient), we can type this to add some files into our storage-pool directory:

# cd /storage-pool
# touch file.txt

If we look at our /gshare directories on each storage server, we will see that file is present on each system:

# cd /gshare (on glusterfs1 and glusterfs2 server)
# ls

-- Testing the High-availability Features:

To check the high-availability, shutdown the glusterfs2 instance. Now, goto the
glusterclient client instance and check the availability of the files:

On glusterclient:

# ls -l /storage-pool

You should see the file even though the glusterfs2 is down.

Next, create some files on glusterclient

# touch /storage-pool/file21.txt
# touch /storage-pool/file22.txt

All the files are now written on glusterfs1. Now, start the glusterfs2 instance.

Now, check the /gshare directory on both servers.

# ls -l /gshare

You should see all files there.

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

0 comments:

Post a Comment

Copyright © 2016 Kousik Chatterjee's Blog