Skip to content

Instantly share code, notes, and snippets.

@shawngmc
Last active June 10, 2019 18:01
Show Gist options
  • Save shawngmc/6ee8a0a1aaf96b541184c645cf9777bb to your computer and use it in GitHub Desktop.
Save shawngmc/6ee8a0a1aaf96b541184c645cf9777bb to your computer and use it in GitHub Desktop.
Gluster Config
#!/bin/bash
# Debug stuff
set -o errexit;
set -o pipefall;
set -o nounset;
set -o xtrace;
# Add repo, package and service
sudo add-apt-repository ppa:gluster/glusterfs-4.1
sudo apt install glusterfs-server
sudo systemctl enable --now glusterd
# Create share point
mkdir -p /gfs/.brick
# Figure out if I'm the master
jq -c '.nodes[]' nodes.json | while read i; do
COMPAREHOSTNAME=echo $i | jq -r '.hostname'
if [ $HOSTNAME -eq $COMPAREHOSTNAME ]; then
MASTER=echo $i | jq -r '.master'
fi
done
# Do master-only setup
if [ $MASTER = true ]; then
declare MNTLIST=""
jq -c '.nodes[]' nodes.json | while read i; do
COMPAREHOSTNAME=echo $i | jq -r '.hostname'
NODEIP=$(echo $i | jq -r '.ip')
# Probe other nodes
if [ $HOSTNAME -ne $COMPAREHOSTNAME ]; then
sudo gluster peer probe $NODEIP
fi
MNTLIST="$MNTLIST $NODEIP:/gfs/.brick"
done
# Apply volume on all nodes
sudo gluster volume create data replica 4 transport tcp $MNTLIST
# Start the volume
sudo gluster volume start data
fi
{ "nodes":
[
{
"hostname": "gluster-1",
"ip": "",
"master": true
},
{
"hostname": "gluster-2",
"ip": "",
"master": false
},
{
"hostname": "gluster-3",
"ip": "",
"master": false
}
]
}
https://mattcurfman.com/index.php/2019/03/25/k38s-on-a-4-node-up-board-cluster/
https://www.digitalocean.com/community/tutorials/how-to-create-a-redundant-storage-pool-using-glusterfs-on-ubuntu-servers
Mount local copy at startup
https://angristan.xyz/how-to-mount-local-glusterfs-volume-boot-fstab-systemd-fix/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment