Matthew Ames

Gluster

Matthew Ames - 2016-03-01 - 8:30 am

Prerequisites

  • At least two servers
  • Your servers should ideally have a second disk or partition each. I recommend that it's formatted with xfs
  • Private network

Please select your architecture

Install the packages

Add the following to file /etc/yum.repos.d/glusterfs-epel.repo/etc/apt/sources.list.d/glusterfs.list:

[glusterfs-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes.
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-$releasever/$basearch/
enabled=1
skip_if_unavailable=1
gpgcheck=1
gpgkey=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/pub.key

[glusterfs-noarch-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes.
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-$releasever/noarch
enabled=1
skip_if_unavailable=1
gpgcheck=1
gpgkey=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/pub.key

[glusterfs-source-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes. - Source
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-$releasever/SRPMS
enabled=0
skip_if_unavailable=1
gpgcheck=1
gpgkey=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/pub.key
deb http://ppa.launchpad.net/gluster/glusterfs-3.7/ubuntu trusty main
deb-src http://ppa.launchpad.net/gluster/glusterfs-3.7/ubuntu trusty main
Now run the install: apt update
yumapt install glusterfs-server glusterfs glusterfs-fuseglusterfs-client

Edit your hosts files

It's easier to refer to each server by some kind of name, so you can use a hosts file for this. It's better than DNS because it'll be quick. Replace the below with the names and hostnames that you would like, but the general feeling is there. This should be done on both servers so that everything works smoothly. The hosts file is in /etc/hosts.

192.168.100.1 glu1
192.168.100.2 glu2

Start the service

systemctl enable glusterd
systemctl start glusterd service glusterfs-server start Probe the peers

From your frist server, probe the second server:

root@glu1# gluster peer probe glu2

And vice versa:

root@glu2# gluster peer probe glu1

Mount your second disk with xfs

We will first format our second disk, then mount it. This should be done on both servers.

mkfs.xfs /dev/xvdb
mkdir /var/lib/gluster
mount /dev/xvdb /var/lib/gluster
mtab -n1 >> /etc/fstab

Create your bricks

On each server we create the bricks to be added to the volume.

root@glu1# /var/lib/gluster/brick1
root@glu2# /var/lib/gluster/brick2

Create the volume

You only need to create the volume on one server because it will send the details to the other

gluster volume create volume1 replica 2 glu1:/var/lib/gluster/brick1 glu2:/var/lib/gluster/brick2
gluster volume start volume1

Mount the volume

Now create the mount point and mount gluster on both servers

mkdir /mnt/gluster
mount -t glusterfs glu1:/volume1 /mnt/gluster -o backup-volfile-servers=glu2

Alternatively, use this to ensure the mount command is the same on both servers

mount -t glusterfs glu1,glu2:/volume1 /mnt/gluster
0 Comments