GlusterFS
From Bashlinux
Setup
How to install GlusterFS with 2 masters
- Install glusterfs and dependencies
# apt-get -y install glusterfs-server glusterfs-client ntp
- Make peers to look for each other, by running on each node at the same time
# gluster peer probe $PEER
- On the primary do:
- Create the volume
# gluster volume create $VOL replica 2 transport tcp $PRI:$VOL_SERVER $SEC:$VOL_SERVER $FORCE
- Start the volume
# gluster volume start $VOL
- Grant access to any client on the same subnet
# gluster volume set $VOL auth.allow $NET.*
- Check the volume status on any node
# gluster volume info
How to mount a volume on a client
- Create an fstab entry
<PEER_IP>:<VOL> <LOCAL_MOUNT> glusterfs defaults,_netdev,backupvolfile-server=<LOCAL_IP> 0 0
- Create the proper direcectory and mount it
# mkdir -p <LOCAL_MOUNT> # mount <LOCAL_MOUNT>
Troubleshooting
- How deal with a volume that can't be created because a previous attempt failed
- ERROR MESSAGE:
volume create: <VOL>: failed: /var/lib/glusterfs-server/<VOL> or a prefix of it is already part of a volume
- Remove the extended attributes to the directory created by gluster
# setfattr -x trusted.glusterfs.volume-id /var/lib/glusterfs-server/<VOL> # setfattr -x trusted.gfid /var/lib/glusterfs-server/<VOL> # rm -rf /var/lib/glusterfs-server/<VOL>/.glusterfs