Home > Article > Operation and Maintenance > Example analysis of nginx load function + nfs server function
Use nfs server to make the web page content of three server servers consistent
#The contos system used in this article
[root@nfs-server ~]# yum install nfs-utils -y
There is no response when checking the nfs process. This is because nfs does not listen to the external port number, but outsources it to rpc. rpc helps nfs to listen to the port, and then tells the client to contact the corresponding port of the machine.
#The download function needs to be configured in 3 servers, otherwise it cannot be downloaded
/web The folder to be shared is the web folder I just created under the root
192.168.83.0/24 shared network segment
rw Yes Read and write
all_squash is used to indicate that all users accessing are restricted to anonymous users
sync writes data to the memory and disk at the same time to ensure no data loss
The parameters in #() can be modified. This article will not explain it in more detail. You can check the official website or other blogs for details.
Output the content just written to the configuration file /etc/exports to the specified network segment
Selinux is a mechanism to protect the security of the Linux system. It is not applicable for the time being. It is recommended to turn off
setenforece 0Temporarily turn off selinux
vim /etc/sysconfig/selinux SELINUX=disabled 永久关闭selinux
Turn off the firewall
service firewalld stop --》Close the firewalld service immediately--》Temporarily shut down
systemctl disable firewalld --》Set the firewalld service not to start at boot--》Permanently shut down
The server also needs to install the nfs-utils package
Use the showmount -e command on the server to view the shared output on the nfs server Which folders are
#If the path is unreachable, consider whether the firewall is not closed
Use the command to mount to the specified folder
#Syntax: mount nfs server directory local directory
If you want to unmount, use umout and add the mounted directory, here it is umount /usr/local/ nginx1/html/
If you don’t remember the mounting directory, you can use the df command to view it
Client access Load balancer 192.168.83.160, the data is the same every time it is accessed. If a certain server modifies the data, then the data of all servers will also be modified. This is what we call data consistency
Although the data of the nfs server is mounted on three servers, the server cannot operate the data, including creating files, etc.
#Whether the server has write permissions depends on two permissions
1. Sharing permissions--"Permissions in the /etc/exports file , such as ro, rw
2. Permissions in the file system--》Permissions of /web in Linux--》Authorization in nfs server
We have given sharing permissions , so you only need to authorize the shared files in the file system of the nfs server
We have write permissions on the server side
Because the mount will fail every time you shut down, we need to allow the server to automatically mount at startup
vim /etc/rc.local mount 192.168.83.100:/web /usr/local/nginx1/html --》在文件内加上一行 chmod +x /etc/rc.d/rc.local --》授权文件
vim /etc/fstab --》加上这一行
192.168.83.22:/web /usr/local/nginx1/html nfs defaults 0 0
192.168.83.22:/web 挂载的分区 --》nfs的文件系统
/usr/local/nginx1/html 在本地的挂载点
nfs 文件系统类型
0 是否支持demp命令进行备份
0 是否开机的时候进行分区的文件检查
The above is the detailed content of Example analysis of nginx load function + nfs server function. For more information, please follow other related articles on the PHP Chinese website!