Skip to content

Instantly share code, notes, and snippets.

@junaidk
Created February 18, 2021 07:31
Show Gist options
  • Save junaidk/404cc217c00907e322e59f2ac206a917 to your computer and use it in GitHub Desktop.
Save junaidk/404cc217c00907e322e59f2ac206a917 to your computer and use it in GitHub Desktop.
GlusterFS with virtual disk

step 0

sudo apt-get install -y xfsprogs

sudo apt install software-properties-common sudo add-apt-repository ppa:gluster/glusterfs-7 sudo apt update sudo apt install -y glusterfs-server

step 1

sudo mkdir /mnt/disks

create virtual disk on all nodes

sudo dd if=/dev/zero of=/mnt/disks/5GB_HDD.img bs=1M count=5120

mount as loop device

sudo losetup -P --show /dev/loop56 /mnt/disks/5GB_HDD.img

format and mount

sudo mkfs.xfs -i size=512 /dev/loop56 sudo mkdir -p /data/brick1 sudo su echo '/dev/loop56 /data/brick1 xfs defaults 1 2' >> /etc/fstab exit sudo mount -a && mount

step 2

sudo service glusterd start sudo service glusterd status

on primary server - Server0

gluster peer probe Server1 gluster peer probe Server2

on second server

gluster peer probe Server0

sudo gluster peer status

On all servers:

sudo mkdir -p /data/brick1/gv0

from any server | create glusterfs volume

sudo gluster volume create gv0 replica 3 s3tel-00:/data/brick1/gv0 s3tel-01:/data/brick1/gv0 Server1:/data/brick1/gv0 sudo gluster volume start gv0

on all servers | mount glusterfs vlume

sudo mkdir -p /mnt/gluster_gv0 sudo mount -t glusterfs server1:/gv0 /mnt/gluster_gv0 sudo chown -R s3tel:s3tel /mnt/gluster_gv0/

check status of volume

gluster volume info

Reference: https://docs.gluster.org/en/latest/Quick-Start-Guide/Quickstart/ https://docs.gluster.org/en/latest/Install-Guide/Install/#for-ubuntu http://www.linuxandubuntu.com/home/creating-virtual-disks-using-linux-command-line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment