
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 glusterdsudo 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
Leave a comment