What is NFS? network file system A method or mechanism for storing and organizing files over a network. Why use NFS? All front-end application servers receive pictures, files, and videos uploaded by users and put them into the back-end storage. The advantages of shared storage: convenient data search and retrieval; the disadvantages: high pressure on the storage server, and all data will be lost if it fails. How NFS works NFS functions have many services, each of which has its own port and changes frequently. When the client looks for these ports, it needs an intermediary - the RPC service (default port number 111). Workflow: 1. Start the RPC service 2. Start the NFS service (and register the startup port with the RPC service) 3. The client requests NFS service from RPC 4.RPC return port to the client 5. The client uses the returned port address to request NFS to transfer data. Install NFS Service Installation: yum install nfs-utils rpcbind View: rpm -qa nfs-utils rpcbind Start the service and set it to start automatically at boot: systemctl start rpcbind.service systemctl enable rpcbind.service systemctl start nfs systemctl enable nfs Configuring NFS nfs configuration file /etc/exports Run the command man exports to find: The format of the configuration file is: Hosts (permissions) to access the shared directory ①Directory to be shared: Directory for accessing data ②Host to access: Single host: 172.16.1.7 or host name segment: 172.16.1.0/24 or 172.16.1.* ③Permissions: rw readable ro read-only sync write to remote disk (slow, safe) async asynchronously write to remote buffer (fast, unsafe) root_squash anonuid=anonymous user's UID anongid=anonymous user's GID all_squash No matter what user the client is, it will be treated as nfsnobody on the server [root@nfs01 ~]# vim /etc/exports Note: A directory can be shared with multiple hosts at the same time, as shown in the test figure above. Note that there is no space between the parentheses and the preceding character. Create a directory: [root@nfs01 ~]# mkdir -p /data The default user of nfs is nfsnobody, so you need to authorize the directory: [root@nfs01 ~]# chown -R nfsnobody.nfsnobody /data Restart NFS: [root@nfs01 ~]# systemctl reload nfs or exportfs -r (smooth restart) examine: Open the web01 virtual machine and install the rpc and nfs services (in principle, the client only needs to install rpc, but we are testing the showmount command here) Mount the shared directory and create a file test The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Three ways to copy MySQL tables (summary)
>>: How to configure path alias for react scaffolding
The /partition utilization of a server in IDC is ...
1. Rounded border: CSS CodeCopy content to clipbo...
Preface: When using MySQL, you may encounter time...
Table of contents The concept of affairs The stat...
1. Download the MySQL jdbc driver (mysql-connecto...
Idea: Just sort randomly first and then group. 1....
Here is how to install Tomcat-8.5.39 on centos7.6...
Table of contents 1. Variables Use meaningful nam...
<br /> Focusing on the three aspects of text...
I've been writing a WeChat applet recently an...
I have recently learned web development front-end...
Table of contents 1. Interface definition 2. Attr...
Preface Bootstrap, the most popular front-end dev...
Use JS to zoom in and out when the mouse is on th...
Table of contents Target Thought Analysis Code la...