Skip to content

Instantly share code, notes, and snippets.

@aric49
Created October 24, 2018 19:45
Show Gist options
  • Select an option

  • Save aric49/61aa6658161cbda101b1b4b82d30d520 to your computer and use it in GitHub Desktop.

Select an option

Save aric49/61aa6658161cbda101b1b4b82d30d520 to your computer and use it in GitHub Desktop.
Docker Gluster Cluster

Gluster Cluster on Docker Host

Pre Requisites

  1. 3 Ubuntu Nodes running docker
  2. DNS Entries for all three nodes
  3. Create partition on the data drive: fdisk /dev/xvdb (New, primary, defaults, defaults)
  4. Create XFS file system on the data drive: mkfs.xfs -i size=512 /dev/xvdb1
  5. Add disk to /etc/fstab: /dev/xvdb1 /data/brick1 xfs defaults 1 2
  6. Mount the drive: mount -a

Steps

  1. Create directory /data/brick1 on all three nodes: mkdir -p /data/brick1

  2. Start the GlusterFS Docker container on the three hosts, making sure to mount the /data/brick1 directory:

docker run --restart unless-stopped -v /etc/glusterfs:/etc/glusterfs:z -v /var/lib/glusterd:/var/lib/glusterd:z -v /var/log/glusterfs:/var/log/glusterfs:z -v /sys/fs/cgroup:/sys/fs/cgroup:ro -d --privileged=true --net=host --name gluster_cluster -v /data/brick1:/data/brick1 -v /dev/:/dev gluster/gluster-centos
  1. Exec into the container and create cluster:
gluster peer probe server2
gluster peer probe server3
gluster peer status
  1. Create and Start Volume:
gluster volume create gv0 replica 3 server1:/data/brick1/gv0 server2:/data/brick1/gv0 server3:/data/brick1/gv0
gluster volume start gv0
  1. Install the glusterfs-client package on all clients: sudo apt install glusterfs-client

  2. Mount volume on client: sudo mount -t glusterfs gluster.fqdn.dns.name:/gv0 /mnt/glustervolume1

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