Gluster is a scalable network filesystem. Using common off-the-shelf hardware, you can create large, distributed storage solutions for media streaming, data analysis, and other data- and bandwidth-intensive tasks. Gluster is free.
this image is use debian with systemd running GlusterFS + NFS-Ganesha
Mount Path Volume
./data/etc/glusterfs /etc/glusterfs # glusterfs config dir
./data/etc/ganesha /etc/ganesha # ganesha config dir
./data/var/lib/glusterd /var/lib/glusterd # glusterd lib dir
./data/var/log/glusterfs /var/log/glusterfs # glusterfs dir
./data/volumes: /volumes # glusterfs volume path
please useing hosting network or macvlan via eth interface
#192.168.88.0/24 please change to your localhost subnet address
sudo docker network create -d macvlan --subnet=192.168.88.0/24 --gateway=192.168.88.1 -o parent=eth0 eth0_net
in docker-compose.yml
version: '3'
services:
main:
.....
networks:
eth0_net:
ipv4_address: 192.168.88.100 #please change it to you subnet ip
networks:
eth0_net:
external: true
this is demo config with macvlan
version: '3'
services:
main:
container_name: glusterfs
hostname: gfs01
restart: always
image: cyrus0880/gluster-cg2:10.3
cgroup_parent: gluster.slice
volumes:
- ./data/etc/ganesha:/etc/ganesha
- ./data/etc/glusterfs:/etc/glusterfs
- ./data/var/lib:/var/lib/glusterd
- ./data/var/log:/var/log/glusterfs
- ./data/volumes:/volumes
privileged: true
networks:
ufh:
eth0_net: 192.168.150.32
networks:
eth0_net:
external: true
this demo config is useing host network
version: '3'
services:
main:
container_name: glusterfs
hostname: gfs01
restart: always
image: cyrus0880/gluster-cg2:10.3
cgroup_parent: gluster.slice
volumes:
- ./data/etc/ganesha:/etc/ganesha
- ./data/etc/glusterfs:/etc/glusterfs
- ./data/var/lib:/var/lib/glusterd
- ./data/var/log:/var/log/glusterfs
- ./data/volumes:/volumes
privileged: true
network_mode: host
Start container
sudo docker compose up -d # start container
Enter container shell
sudo docker compose exec main bash # enter container
# in the container shell
root@gfs01:/$
Create the node pool
# add node (the note ip please change to use your)
gluster peer probe 192.168.88.130
gluster peer probe 192.168.88.131
gluster peer probe 192.168.88.132
gluster peer probe 192.168.88.133
#remove node
gluster peer detach 192.168.88.xxx
#node info
gluster pool list
UUID Hostname State
74cccc05-5ee8-428f-870e-82b5e78e5f5c 192.168.88.131 Connected
55fa95cb-e024-472a-8def-0681be5944fd 192.168.88.132 Connected
6dbffffd-2041-4679-9693-b9622279a524 192.168.88.133 Connected
2a6367a6-eca4-4179-80ed-b838b5d22b82 localhost Connected
#Create Volume with replica mode
gluster volume create gfs_share replica 4 \
192.168.88.130:/volumes/gfs_share \
192.168.88.131:/volumes/gfs_share \
192.168.88.132:/volumes/gfs_share \
192.168.88.133:/volumes/gfs_share
#Check Volume info & state
gluster volume start gfs_share
#Check Volume info & state
gluster volume status
#removing node from volume
gluster volume remove-brick gfs_share replica 3 192.168.88.xxx:/volumes/dk-gfs force
#add new node form volume
gluster volume add-brick gfs_share replica 4 192.168.88.xxx:/volumes/dk-gfs
#diasble volume old nfs support for NFS-Ganesha
gluster volume set gfs_share nfs.disable on
# in you docker-compose.yml same path
mv ./data/etc/ganesha/gluster.conf ./data/etc/ganesha/gluster.conf.bk
mv ./data/etc/ganesha/ganesha.conf ./data/etc/ganesha/ganesha.conf.bk
vi ./data/etc/ganesha/ganesha.conf
and use this config
./data/etc/ganesha/ganesha.conf
EXPORT{
Export_Id = 1 ; # Export ID unique to each export
Path = "/gfs_share"; # Path of the volume to be exported. Eg: "/test_volume"
Pseudo = "/gfs_share"; # NFSv4 pseudo path for this export. Eg: "/test_volume_pseudo"
Disable_ACL = TRUE; # To enable/disable ACL
Access_type = RW; # Access permissions
Squash = No_root_squash; # To enable/disable root squashing
SecType = "sys"; # Security flavors supported
Protocols = "3","4" ; # NFS protocols supported
Transports = "UDP","TCP" ; # Transport protocols supported
FSAL {
name = GLUSTER;
hostname = "localhost"; # IP of one of the nodes in the trusted pool
volume = "gfs_share"; # Volume name. Eg: "test_volume"
}
}
After edit config
systemctl restart nfs-ganesha # restart Ganesha service
showmount -e localhost
# if you got this your nfs server is up
Export list for localhost:
/gfs-share (everyone)
glusterfs client
# if Debian please install glusterfs client
apt install glusterfs-client
mkdir /mnt/share
# mount testing
mount -t glusterfs 192.168.88.130:gfs_share /mnt/share
touch /mnt/share/testfile
umount /mnt/share
# Start Mount
echo "192.168.88.130:gfs_share /mnt/share glusterfs defaults,_netdev,backupvolfile-server=192.168.88.131 0 0" >> /etc/fstab
mount -a # mount reload
nfs client
# if Debain Please install nfs client
apt install nfs-common
mkdir /mnt/share
# mount testing
mount.nfs 192.168.88.130:gfs_share /mnt/share
touch /mnt/share/testfile
umount /mnt/share
# Start Mount
echo "192.168.88.130:gfs_share /mnt/share nfs defaults 0 0" >> /etc/fstab
mount -a # mount reload
docker plugin install --alias glusterfs trajano/glusterfs-volume-plugin --grant-all-permissions --disable
docker plugin set glusterfs SERVERS=gluster1,gluster2,gluster3
docker plugin enable glusterfs
Content type
Image
Digest
sha256:07dd50b78…
Size
172.5 MB
Last updated
almost 3 years ago
docker pull cyrus0880/gluster-cg2:10.3