Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page explains how to setup Gluster network filesystems that can be mounted by multiple virtual machines, in particular, MPI(or GNU/parallel) cluster nodes.

If you have questions and suggestions about this tutorial page and related problems, please, contact Min-Su Shin.

Case A: Filesystem with a single Gluster server

Gluster filesystem can be prepared with a single server and its disk space to serve multiple clients. In this case A, we assume that a single Gluster server is made to be used by multiple VMs (virtual machines) included in a cluster.

Step 1. Creating a single VM

...

On the created VM, we install the Gluster server program and configure a Gluster filesystem. For your convenience, you can find a shell script that should be executed by root account. See https://github.com/astromsshin/cloud_ex and the script https://github.com/astromsshin/cloud_ex/blob/main/tool_setup_glusterfs_single_server.sh which is presented below:

Code Block
languagebash
#!/bin/bash

# Directory serving the Gluster filesystem
TARGETDIR="/glusterfs/vol"
# Gluster filesystem volume available for clients
TARGETVOL="gvol"
# Name of the Gluster server
VMNAME="test-gl-vm"

# Install the server
apt install glusterfs-server -y
systemctl enable --now glusterd

# Information
gluster
# (optional)
#gluster --version
systemctl#systemctl status glusterd

# Prepare the directory
mkdir -p ${TARGETDIR}
# Produce the Gluster filesystem volume with the above directory
gluster volume create ${TARGETVOL} ${VMNAME}:${TARGETDIR} force
# Make the volume available
gluster volume start ${TARGETVOL}

# Information
gluster# (optional)
#gluster volume info
gluster#gluster volume status

Step 3. Mounting the created Gluster filesystemt on client VMs

The created network filesystem can be mounted on client VMs by using mount command with required options. A simple script is available as https://github.com/astromsshin/cloud_ex/blob/main/tool_setup_glusterfs_client_all_nodes-single_server.sh  in the github repository https://github.com/astromsshin/cloud_ex. The script is given below:

Code Block
languagebash
#!/bin/bash

# Name of the cluster which defines the clients' names
CLUSTERNAME="ml-image"
# Last integer index of the minions in the cluster
MINIONLASTIND="8"
# IP of the Gluster server
GLUSTERSERVERIP="10.0.100.150"
# Name of the Gluster server
GLUSTERSERVERNAME="test-gl-vm"
# Directory name which is a mount point on clients
TARGETDIR="/mnt/gluster"


RUNCMD="apt -y install glusterfs-client; echo ${GLUSTERSERVERIP} ${GLUSTERSERVERNAME} >> /etc/hosts;mkdir ${TARGETDIR}; mount -t glusterfs ${GLUSTERSERVERNAME}:/gvol ${TARGETDIR}; chmod -R 777 ${TARGETDIR}"

echo "... setuping on ${CLUSTERNAME}-master"
echo $RUNCMD | bash

for ind in $(seq 0 ${MINIONLASTIND})
do
  echo "... setuping on ${CLUSTERNAME}-minion-${ind}"
  ssh ${CLUSTERNAME}-minion-${ind} "${RUNCMD}"
done

In the above script, we assume that the filesystem is mounted on multiple VMs created as explained in Deploy Message Passing Interface (MPI) (and/or GNU parallel) cluster.