How To Install and Setup Glusterfs on debian
The following article describes how to install and setup Glusterfs on a Debian distribution
GlusterFS 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. GlusterFS is free and open source software.
Install the package by running the following command on all the servers
# apt-get install glusterfs-server
# apt-get install glusterfs-client
Now we need to add the gluster2 to the peer list
# gluster peer probe gluster2
Now we need to create the volume where the data will reside. the volume will be called datastore. First of all, we need to identify where on the host this storage is. For this example, it is/mnt/gfs_block on both nodes, but this could be any mount point of storage that you have. If the folder does not exist, it will be silently created so be sure to get the correct path on all nodes.
Run the following command to setup the cluster
# gluster volume create datastore replica 2 transport tcp server01:/mnt/gfs_block server02:/mnt/gfs_block
If this has been successful, you should see: Creation of volume testvol has been successful. Please start the volume to access data
Now you can start the volume
# gluster volume start datastore
Mount the glusters
# mount -t glusterfs server:/VOLUME /directory
example: mount.glusterfs gluster1:/datastore /var/www/
You should now have a GlusterFS volume which will maintain replication across two nodes.
To see the volume and nodes
# gluster volume info
Running either of the below commands should indicate that GlusterFS is up and running. The ps command should show the command running with both servers in the argument. netstat should show a connection between both nodes.
# ps aux | grep gluster
# netstat -tap | grep glusterfsd
Delete the volume using the following command:
# gluster volume delete VOLNAME
For example, to delete datastore:
# gluster volume delete datastore
Deleting volume will erase all information about the volume. Do you want to continue? (y/n)
Enter “y” to confirm the operation. The command displays the following:
Deleting volume datastore has been successful