How To Set Up A NFS Share For An HA Environment On CentOS 7

Overview

CloudBolt is able to use a number of different network storage protocols supported by the underlying CentOS 7. We recommend using NFS as your network storage protocol, as it is widely supported and highly available solutions are often in place that CloudBolt can leverage. This article will show you one way of setting up a NFS share between servers.


Procedure

Setting up the NFS Server

In order to setup NFS mounts, you will need at least 2 servers, with 1 server being the NFS Server and one being the NFS Client.

On both the NFS Server and the Client Server:

Install nfs-utils:

yum install nfs-utils 

Start the services on both servers:

systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap

NFS Server

On the NFS Server, share required directories

The following directories are required to be shared for a CloudBolt HA environment:

/var/opt/cloudbolt

/var/log/cloudbolt/jobs

/var/www/html/cloudbolt/static

Open /etc/exports :

vi /etc/exports

Add sharing points:

(Replace 00.00.00.00 with IP of your other web server)

/var/opt/cloudbolt                  00.00.00.00(rw,sync,no_root_squash,no_all_squash)
/var/log/cloudbolt/jobs             00.00.00.00(rw,sync,no_root_squash,no_all_squash)
/var/www/html/cloudbolt/static      00.00.00.00(rw,sync,no_root_squash,no_all_squash)

Restart the NFS Service:

systemctl restart nfs-server

Add NFS Service override in CentOS 7 firewall-cmd public zone service:

firewall-cmd --permanent --zone=public --add-service=nfs
firewall-cmd --permanent --zone=public --add-service=mountd
firewall-cmd --permanent --zone=public --add-service=rpc-bind
firewall-cmd --reload

NFS Client Server

Rename directories that will be shared:

mv /var/opt/cloudbolt /var/opt/cloudbolt.OLD
mv /var/log/cloudbolt/jobs /var/log/cloudbolt/jobs.OLD
mv /var/www/html/cloudbolt/static /var/www/html/cloudbolt/static.OLD

Create empty directories that will be shared:

mkdir /var/opt/cloudbolt 
mkdir /var/log/cloudbolt/jobs
mkdir /var/www/html/cloudbolt/static

Mount the shared directories from the NFS Server:

(Replace 00.00.00.00 with IP of your NFS Server)

mount -t nfs 00.00.00.00:/var/opt/cloudbolt /var/opt/cloudbolt
mount -t nfs 00.00.00.00:/var/log/cloudbolt/jobs /var/log/cloudbolt/jobs
mount -t nfs 00.00.00.00:/var/www/html/cloudbolt/static /var/www/html/cloudbolt/static

Verify the connection with the NFS Server:

df -kh

Add permanent NFS mounting in fstab:

vi /etc/fstab

Add the directories that will be mounted:

(Replace 00.00.00.00 with IP of your NFS Server)

00.00.00.00:/var/opt/cloudbolt /var/opt/cloudbolt             nfs defaults 0 0
00.00.00.00:/var/log/cloudbolt/jobs /var/log/cloudbolt/jobs   nfs defaults 0 0
00.00.00.00:/var/www/html/cloudbolt/static /var/www/html/cloudbolt/static   nfs defaults 0 0

NFS should now be set up properly for your CloudBolt HA environment!

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.