GlusterFS volume with Docker
830 بار بازدید -
3 سال پیش
-
How to use GlusterFS volume
How to use GlusterFS volume with Docker or Docker Swarm.
Assume there are two nodes available for the cluster.
1. Host Resolving:
make sure `/etc/hosts` has all nodes IPs and hostnames mapped correctly.
2. Install GlusterFS on each node:
run these commands on each node
apt-get install software-properties-common -y
add-apt-repository ppa:gluster/glusterfs-3.12
apt-get update
apt install glusterfs-server -y
systemctl start glusterd
systemctl enable glusterd
ssh-keygen -t rsa
3. Test
On the master node, run these commands:
gluster peer probe host01; gluster peer probe host02;
where `host01` & `host02' are the node names.
- Run this command to list connectivity status of each node.
gluster pool list;
3. Shared Storage
On each node, create a space where the shared directory
mkdir -p /gluster/share;
4. Create the volume
- Run these commands on the host machine
gluster volume create staging-gfs replica 2 host01:/gluster/share host02:/gluster/share force;
gluster volume start staging-gfs;
5. Auto mount on reboot
- Run these commands on each node to allow starting the volume upon system reboot.
echo 'localhost:/staging-gfs /mnt glusterfs defaults,_netdev,backupvolfile-server=localhost 0 0' >> /etc/fstab;
mount.glusterfs localhost:/staging-gfs /mnt;
chown -R root:docker /mnt;
6. Check the volume is mounted
On each node, run this command and check it is mounted
df -h;
Reference:
https://thenewstack.io/tutorial-creat...
Assume there are two nodes available for the cluster.
1. Host Resolving:
make sure `/etc/hosts` has all nodes IPs and hostnames mapped correctly.
2. Install GlusterFS on each node:
run these commands on each node
apt-get install software-properties-common -y
add-apt-repository ppa:gluster/glusterfs-3.12
apt-get update
apt install glusterfs-server -y
systemctl start glusterd
systemctl enable glusterd
ssh-keygen -t rsa
3. Test
On the master node, run these commands:
gluster peer probe host01; gluster peer probe host02;
where `host01` & `host02' are the node names.
- Run this command to list connectivity status of each node.
gluster pool list;
3. Shared Storage
On each node, create a space where the shared directory
mkdir -p /gluster/share;
4. Create the volume
- Run these commands on the host machine
gluster volume create staging-gfs replica 2 host01:/gluster/share host02:/gluster/share force;
gluster volume start staging-gfs;
5. Auto mount on reboot
- Run these commands on each node to allow starting the volume upon system reboot.
echo 'localhost:/staging-gfs /mnt glusterfs defaults,_netdev,backupvolfile-server=localhost 0 0' >> /etc/fstab;
mount.glusterfs localhost:/staging-gfs /mnt;
chown -R root:docker /mnt;
6. Check the volume is mounted
On each node, run this command and check it is mounted
df -h;
Reference:
https://thenewstack.io/tutorial-creat...
3 سال پیش
در تاریخ 1400/01/27 منتشر شده
است.
830
بـار بازدید شده