Skip to content

GlusterFS

Install on all nodes:

apt-get -y install glusterfs-server
sudo systemctl start glusterd
sudo systemctl enable glusterd

Prepare disks

Bricks

Bricks in GlusterFS are basic building blocks that represent individual disk storage. A GlusterFS storage volume is created by grouping multiple bricks together. These bricks can be located on different servers and combined to create a large and scalable distributed file system. Bricks are used to store actual data and make up the physical storage of the GlusterFS volume.

On each node

Find your disks

fdisk -l

the 50 gig disk is your glustersf disk /dev/sdb.

format your disk

mkfs.xfs -f /dev/sdb

create your storage location

mkdir -p /data/glusterfs/myvol1/brick1

echo "/dev/sdb /data/glusterfs/myvol1/brick1 xfs defaults 0 0" | tee -a /etc/fstab
mkdir -p /data/glusterfs/myvol1/brick1/brick
mount -a

Cluster

On node1 we can now inform GlusterFS of the presence of all nodes in the network.

gluster peer probe node2
cluster peer probe node3
gluster pool list

Volume

To create a GlusterFS volume using 3 nodes, make sure the disks have been mounted under “/data/glusterfs/myvol1” and that the folder “/data/glusterfs/myvol1/brick1” has been created on all 3 nodes.

On node1:

gluster volume create dockervol1 disperse 3 redundancy 1 node1:/data/glusterfs/myvol1/brick1 node2:/data/glusterfs/myvol1/brick1 node3:/data/glusterfs/myvol1/brick1

gluster volume info dockervol1

Start the volume.

gluster volume start dockervol1

We have our volumes, now we can mount one of them to nodes.

On all nodes:

mkdir /mnt/docker-storage
echo "localhost:/dockervol1 /mnt/docker-storage glusterfs defaults,_netdev 0 0" | tee -a /etc/fstab

The persistent shared storage will be “/mnt/docker-storage” where compose files will reference.

Published inhomelab

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *