Best Practice about Sharing Files between Servers

Prasad Jayasinghe
2 min readFeb 10, 2019

First of all I have to tell this for all folks who are reading this article…. this is my very first article I have published in medium.

Lets begin…

If you have more server to deal with the best practice is make one single point to access all the servers. Focusing to this scenario, here I have 10 servers to install “zookeper” software. Before install “zookeepr” we have to install “Java”.

In normal way and the painful way is copy these two software to all the servers and install one by one. or else the best way is download these two software in to one server and share the location between servers, to do that I’m going to use NFS- Network File Sharing concept. Believe me guys this is the best..

Configuration…

In this concept mainly we have two section

  1. sever
  2. client

Server configuration..

Install software

# yum install nfs-utils

Configure share directory and change the ownership to nfsnobody user and group

# mkdir /data
# chown nfsnoboday:nfsnoboday /data

Update “ecport” file to allow access to clients

# vi /etc/exports

-- sytax --
<share directory> <Serverip>(permissions)

Eg:

/data 192.168.1.11(rw)

Configure security parameters

# firewall-cmd --permanent --add-service=nfs
# firewall-cmd --reload
# iptables -F

Finally restart and enable the service

# systemctl restart nfs
# systemctl enable nfs

Client Configurations..

Install software

# yum install nfs-utils

Make mount directory

# mkdir /data

Configure security parameters

# firewall-cmd --permanent --add-service=nfs
# firewall-cmd --reload
# iptables -F

Finally restart and enable the service

# systemctl restart nfs
# systemctl enable nfs

Check the remote mount point visibility

Configure security parameters

# firewall-cmd --permanent --add-service=nfs
# firewall-cmd --reload
# iptables -F

Finally restart and enable the service

# showmaunt -e <nfs-server ip or hostname>

Eg:

[root@bigd2 data]# showmount -e node1
Export list for node1:
/data 192.168.1.13,192.168.1.12

Update the fstab to mount the remote location

# vim /etc/fstab

- -sytax- -
<Serverip>:<share directory> <local directory> nfs defaults 0 0

Eg:

192.168.1.11:/data /data nfs defaults 0 0

# mount -a

Now you can add files or any data to your shared/mounted director to share with other nodes.

Hope this will help you..

Enjoy the NFS :)

--

--