当前位置:网站首页>Introduction and parameter description of NFS storage service

Introduction and parameter description of NFS storage service

2020-12-06 13:58:46 Zhang Zhixiang

NFS yes Network File System Abbreviation , Represents a network file system , Its main function is through the network ( It's usually a local area network ) Let different host systems share files or directories ,NFS Shared file system configuration file case description :

1、 Configuration example 1

/data 10.0.0.0/24(rw,sync)
 explain : Allow clients to read and write , And the data is synchronously written to the disk on the server side 
 Be careful :24 and “(” There must be no space between them 

2、 Configuration case 2

/data 10.0.0.0/24(rw,sync,all_squash,anonuid=2000,anongid=2000)
 explain : Allow clients to read and write , And the data is synchronously written to the disk on the server side , And specify the client's user UID and GID.
 A configuration of the early production environment , Suitable for multiple clients to share one NFS Service list Directory ,
 If all the servers nfsnobody Account UID All are 65534, There is no need for this example .
 In the early centos5.5 By default nfsnobody Of UID Is not necessarily 65534, At this point, if these servers share a NFS Catalog , There will be access problems .

3、 Configuration case 3

/home/oldboy 10.0.0.0/24(ro)   <--  It is to prepare configuration mode for developers to view line data 
 explain : Read only sharing 
 purpose : For example, in a production environment , Developers have the need to view the production server logs , But you don't want to give permission to develop production servers , Then you can provide development from a test server NFS View the log directory of a production server on the client (NFS share ) Authority , Of course, this is not the only way , For example, you can send the log recorded by the program to the test server for development to view, or display it by collecting logs and other ways 

4、NFS Shared file system configuration file parameter settings

Parameters Parameter description
ro read-only, Indicates read-only permission
rw read-write, Indicates read-write permission
async Write data is written to memory first , Wait until the disk is idle before writing to the hard disk , This can improve efficiency ! risk : If the server is down or shut down abnormally , It will lose the data in the cache that is not written to the hard disk ( resolvent : Server motherboard battery plus ups,AB( Dual power supply ) Uninterruptible power supply !)
sync When writing data , Synchronous write to NFS server It's in the hard disk . advantage : Data is not easy to lose ; shortcoming : Slow data transmission
no_root_squash keep root Users don't compress ; visit NFS If the user of the server's shared directory is root user , It has root jurisdiction , This configuration was originally prepared for diskless clients . Users should avoid using
root_squash If you visit NFS Server is root user , Then its permissions will be compressed into anonymous users , meanwhile , its UID And GID It usually becomes nfsnobody user
all_squash No matter who the users are , Will be compressed into anonymous users , meanwhile , its UID And GID Will become nfsnobody Account identity ; Configure... In a production environment NFS An important skill of :1. Make sure that all client servers are on NFS Shared directories have the same access rights (a.all_squash Compress all clients into fixed anonymous users (UID identical ) Namely anonuid And anongid designated UID And GID user )2. All clients and servers need to have the same UID And GID user , namely nfsnobody(UID It has to be the same )
anonuid Of the specified anonymous user UID Number , Parameter with anon* The beginning is designated anonymous Anonymous users , Of course, you can also set this by yourself UID value , however UID Must exist in /etc/passwd In file , In a multiple NFS When the client , Like many web server Share a directory , With this parameter, you can use different NFS The client writes data to all NFS The client maintains the same permissions , That is, configured anonymity UID The corresponding user , General default
anongid Of the specified anonymous user GIG Number

NFS The introduction of storage service and parameter description is completed .

版权声明
本文为[Zhang Zhixiang]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201206135540234c.html

随机推荐