NFS realizes remote mounting of MariaDB database

NFS (Network File System) uses the network to realize the file sharing function of different operating systems. The NFS server allows the client to mount the directory shared by the NFS server in the network to the local file system, which is equivalent to the client disk is generally easy to use.

Build tutorial:

NFS server side:

1. Check whether NSF software exists on the NFS server

1 $ rpm -qa | grep nfs

If there is an echo, skip the first step, if there is no echo, the next step will be installed

1 $ yum install nfs-utils

2. Modify the configuration file exports

Vim $ / etc / Exports add profile #
/ var / lib / mysql 17.94 . 14.39 (RW, the no_root_squash, the async)
# 17 to allow IP 94.14 .39 server accessing the server / var / lib / mysql folder ( MariaDB default storage path), and set the operation rules

3. Restart the NFS service

1 $ systemctl start rpcbind.service # start port forwarding
 2 $ systemctl start nfs # start NFS
 3 $ expertfs -rv # refresh configuration file

4. Add firewall rules

1 $ iptables -I INPUT -p tcp -m multiport --dports 875,2049,111,28300,5076,39927,46286 -j ACCEPT    
2 $ iptables -I INPUT -p udp -m multiport --dports 875,2049,111,37747,31166,9292,57181 -j ACCEPT

Client:

1. Configuration preparation

1 $ yum  install nfs- utils #install nfs service
 2  $ systemctl start rpcbind   
 3  $ systemctl enable rpcbind
 4 $ systemctl status rpcbind #lack of recognition

2. Mount

1 $   mkdir   -p / mnt / nfs / DVWA1 #New client mount directory
 2 $   mount -t nfs 17.94 . 14.39 : / var / lib / mysql / mnt / nfs / DVWA1 3 $   mount | grep nfs #Check
 mount Method
 4 $   df -h #Check the disk mounting distribution and check whether the mounting is successful

 

Guess you like

Origin www.cnblogs.com/smallpo1nt/p/12727949.html