I was interested in setting up persistent storage for some containers like WordPress, NextcloudPi, Pihole, and UnFi. My research lead me to GlusterFS using replicas. I borrowed from these sources:
- Gluster Docs
- Tutorial: Create a Docker Swarm with Persistent Storage Using GlusterFS
- Making docker swarm redundant
- How to Setup Raspberry Pi SSH Keys for Authentication
Gluster’s docs describes their product as “a scalable, distributed file system that aggregates disk storage resources from multiple servers into a single global namespace.” What this means for me is a shared space to save data and config files while containers are spun up and brought down. Any changes to the mounted glusterfs drive is replicated to all the peer bricks.
I added three Samsung Plus 32GB USB 3.1 Flash Drives to FrankenPi for some additional high speed storage to host the gluster data.
- Update apt with the command:
sudo apt-get update - Install and configure GlusterFS on each server within the swarm.
sudo apt install software-properties-common -y
sudo apt install glusterfs-server -y
Start and enable GlusterFS with the commands:sudo systemctl start glusterd
sudo systemctl enable glusterd
- If you haven’t already done so, you should generate an SSH key for all nodes and copy them to the other nodes.
See: https://pimylifeup.com/raspberry-pi-ssh-keys/
Use these sections:
Generating SSH Keys on Linux based systems
and
Copying the Public Key using SSH Tools - Probe the nodes from the master node only (picluster1):
- sudo -s
gluster peer probe picluster2;gluster peer probe picluster3; - Verify with:
gluster pool list
UUID Hostname State
02c0656a-0637-4889-a185-264b56d6b24f picluster3 Connected
2a5c475a-23de-455b-a6a9-45f08e855b3c picluster2 Connected
bcb63335-b76f-459e-8195-352f1c0e719d localhost Connected - Exit root:
exit
- sudo -s
- Create the Gluster Volume. a. This same command will be run on all machines:
sudo mkdir -p /gluster/volume1
Wow! Give us more! How is it working? What would you do different? What is the context you added this to — I understand docker and raspberry – but other details would be great! Thanks for sharing this!
I don’t see an existing how-to for that specific approach, after a bit of googling around.
I believe I did see containers for that approach.
https://hub.docker.com/search?q=Gluster&type=image
Could you set up GlusterFS inside a docker stack (i.e., no apt-get) to achieve the same result?
I have 3 manager nodes and 3 worker nodes, and all 3 workers have an SSD mounted at
/media/persistent/
I’d like to just run
$ docker stack deploy -c swarm.yaml glusterfs
and have a GlusterFS already running ready for my other stacks.
Is that possible? Do you know if there’s any guide on that?