GlusterFS
Scalable network filesystem.
Overview
GlusterFS is an open-source, distributed file system designed to scale to petabytes and handle thousands of clients. Originally developed by Gluster Inc. (later acquired by Red Hat), GlusterFS aggregates storage from multiple servers into a single global namespace, providing high availability and fault tolerance through replication and distribution mechanisms. Unlike traditional network-attached storage solutions, GlusterFS operates without metadata servers, using elastic hashing algorithms to locate files across the cluster. This Docker configuration establishes a two-node GlusterFS cluster using the official gluster-centos containers, each running as privileged containers to access low-level storage operations. The setup creates a replicated volume that maintains copies of data across both nodes, ensuring data redundancy and availability even if one node fails. The configuration isolates GlusterFS traffic on a dedicated Docker network while providing persistent storage for configuration files, logs, and the actual data being served. This stack is ideal for organizations requiring scalable, fault-tolerant storage that can grow horizontally by adding more nodes, making it particularly valuable for cloud-native applications, container orchestration platforms, and distributed computing environments where traditional shared storage becomes a bottleneck.
Key Features
- Elastic hash algorithm eliminates metadata servers and single points of failure
- Replica 2 configuration ensures data redundancy across both GlusterFS nodes
- FUSE-based client mounting allows POSIX-compliant file system access
- Self-healing capabilities automatically recover corrupted or missing files
- Volume management through native GlusterFS CLI commands for creation and administration
- Brick-level storage abstraction enables flexible underlying storage configurations
- Online volume operations support adding and removing storage without downtime
- Distributed hash table architecture provides linear scalability by adding nodes
Common Use Cases
- 1Container persistent storage for Kubernetes and Docker Swarm clusters
- 2Distributed file sharing for development teams working across multiple servers
- 3Media streaming platforms requiring high-throughput distributed storage
- 4Backup storage systems with built-in replication across geographic locations
- 5Web content delivery networks needing synchronized file distribution
- 6Scientific computing clusters requiring shared datasets across compute nodes
- 7Home lab environments testing distributed storage before production deployment
Prerequisites
- Docker host with privileged container support and sufficient storage space
- At least 4GB RAM per node for optimal GlusterFS performance
- Understanding of GlusterFS volume types (distribute, replica, stripe)
- Network connectivity between containers for brick synchronization
- Basic knowledge of FUSE filesystem mounting and troubleshooting
- Familiarity with GlusterFS CLI commands for volume management
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 gluster1: 3 image: gluster/gluster-centos:latest4 container_name: gluster15 privileged: true6 hostname: gluster17 volumes: 8 - gluster1_data:/data9 - gluster1_etc:/etc/glusterfs10 - gluster1_lib:/var/lib/glusterd11 - gluster1_log:/var/log/glusterfs12 networks: 13 - gluster1415 gluster2: 16 image: gluster/gluster-centos:latest17 container_name: gluster218 privileged: true19 hostname: gluster220 volumes: 21 - gluster2_data:/data22 - gluster2_etc:/etc/glusterfs23 - gluster2_lib:/var/lib/glusterd24 - gluster2_log:/var/log/glusterfs25 networks: 26 - gluster2728volumes: 29 gluster1_data: 30 gluster1_etc: 31 gluster1_lib: 32 gluster1_log: 33 gluster2_data: 34 gluster2_etc: 35 gluster2_lib: 36 gluster2_log: 3738networks: 39 gluster: 40 driver: bridge.env Template
.env
1# Configure volume after containers startUsage Notes
- 1Create volume: gluster volume create vol1 replica 2 gluster1:/data gluster2:/data
- 2Start volume: gluster volume start vol1
- 3Mount on client: mount -t glusterfs gluster1:/vol1 /mnt
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
gluster1
gluster1:
image: gluster/gluster-centos:latest
container_name: gluster1
privileged: true
hostname: gluster1
volumes:
- gluster1_data:/data
- gluster1_etc:/etc/glusterfs
- gluster1_lib:/var/lib/glusterd
- gluster1_log:/var/log/glusterfs
networks:
- gluster
gluster2
gluster2:
image: gluster/gluster-centos:latest
container_name: gluster2
privileged: true
hostname: gluster2
volumes:
- gluster2_data:/data
- gluster2_etc:/etc/glusterfs
- gluster2_lib:/var/lib/glusterd
- gluster2_log:/var/log/glusterfs
networks:
- gluster
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 gluster1:5 image: gluster/gluster-centos:latest6 container_name: gluster17 privileged: true8 hostname: gluster19 volumes:10 - gluster1_data:/data11 - gluster1_etc:/etc/glusterfs12 - gluster1_lib:/var/lib/glusterd13 - gluster1_log:/var/log/glusterfs14 networks:15 - gluster1617 gluster2:18 image: gluster/gluster-centos:latest19 container_name: gluster220 privileged: true21 hostname: gluster222 volumes:23 - gluster2_data:/data24 - gluster2_etc:/etc/glusterfs25 - gluster2_lib:/var/lib/glusterd26 - gluster2_log:/var/log/glusterfs27 networks:28 - gluster2930volumes:31 gluster1_data:32 gluster1_etc:33 gluster1_lib:34 gluster1_log:35 gluster2_data:36 gluster2_etc:37 gluster2_lib:38 gluster2_log:3940networks:41 gluster:42 driver: bridge43EOF4445# 2. Create the .env file46cat > .env << 'EOF'47# Configure volume after containers start48EOF4950# 3. Start the services51docker compose up -d5253# 4. View logs54docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/glusterfs/run | bashTroubleshooting
- Transport endpoint is not connected: Check if glusterd service is running and volumes are started with 'gluster volume status'
- Peer probe failed: Verify container hostnames resolve correctly and use 'gluster peer probe <hostname>' to establish connections
- Volume creation fails with brick path error: Ensure /data directory exists and has proper permissions within containers
- Split-brain condition detected: Use 'gluster volume heal <volume> info split-brain' to identify and resolve conflicting files
- Mount operation hangs: Verify glusterfs-fuse is installed on client and check network connectivity to GlusterFS nodes
- Performance degradation on writes: Check replica count and network latency between nodes, consider tuning performance options
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download