当前位置:网站首页>NFS operations and deployment
NFS operations and deployment
2022-06-24 01:38:00 【jackxiao】
1 Basic knowledge of
1.1 Brief introduction and application scenarios
- sketch NFS : Network file system (network file system), Through the network, different host systems can share files or directories , The client accesses the server by attaching the server directory to the local
- Application scenarios : More than one web When the cluster provides external access through the load balancer , Put all pictures 、 The attachment 、 Video, etc. are stored on a specific server , Avoid scattered storage in web Data synchronization problems on the server
1.2 Benefits and principles
- Now shared storage benefits :
- Achieve data consistency
- Save site disk resources
- Save site access bandwidth
- Port and RPC: NFS There is no fixed external port , Free ports are randomly selected for each startup , To enable clients to access through the network NFS share , You use RPC service ,RPC Services are equivalent to intermediaries ,NFS Every time you start, you will send a message to RPC Notification port information , Customer access NFS Sharing is also the first step RPC obtain NFS And then use this port to access NFS Shared resources RPC Service comes before NFS Service startup ,NFS To work properly
- NFS The principle of shared storage services : nfs Server creates shared storage directory nfs Client creates remote mount point directory nfs Remote mount by client Realize the unification and consistency of client data information
2 NFS Service deployment
2.1 environmental information
2.1.1 system information
[[email protected] ~]# cat /etc/redhat-release CentOS release 6.9 (Final) uname -r 2.6.32-696.el6.x86_64
2.1.2 server information
Server name | IP Address | Server usage |
|---|---|---|
nfs01 | 192.168.1.41 | nfs Backup server |
web01 | 192.168.1.7 | web The server |
web02 | 192.168.1.8 | web The server |
web03 | 192.168.1.9 | web The server |
2.2 Server deployment
- Check and install NFS service
rpm -aq|egrep "nfs-utils|rpcbind" yum install nfs-utils rpcbind -y rpm -aq|egrep "nfs-utils|rpcbind"
# Check whether the two software are installed , Check again after installation 2) edit nfs The configuration file
cat >>/etc/exports <<"EOF" /data 172.16.1.0/24(rw,sync) EOF
The file exists by default 3) Create a shared directory and authorize
mkdir /data chown -R nfsnobody.nfsnobody /data # nfsnobody The user is installing nfs Program is created automatically
- start-up rpc and NFS service
/etc/init.d/rpcbind start /etc/init.d/nfs start
Start first rpc service 5) Check the service status and whether the shared directory is available
[[email protected] ~]# rpcinfo -p 172.16.1.31 # Yes rpc Service 111 port ,nfs Service 2049 port , And a lot of mount port , Said right [[email protected] ~]# showmount -e 10.0.0.31 Export list for 172.16.1.31: /data 172.1.1.0/24
If the above results occur , Indicates that the server configuration is successful It is better to mount it locally , The mount succeeds. The mount is cancelled , At least confirm that the server configuration is correct , Able to mount 6) Set boot up and check
chkconfig nfs on chkconfig rpcbind on chkconfig --list|egrep "nfs|rpcbind"
2.3 Client Deployment [3 The same operation as the console ]
- Check and install NFS service
rpm -aq|egrep "nfs-utils|rpcbind" yum install nfs-utils rpcbind -y
- Mount the shared directory
[[email protected] ~]# showmount -e 172.16.1.31 [[email protected] ~]# mount -t nfs 172.16.1.31:/data /mnt [[email protected] ~]# df -h|tail -1 Filesystem Size Used Avail Use% Mounted on 172.16.1.31:/data 8.6G 1.9G 6.4G 23% /mnt
- Set the boot auto mount
echo " mount -t nfs 172.16.1.31:/date /mnt " >>/etc/rc.local
Don't put in /etc/fatab Do boot up , because fstab It started earlier , At that time, the network service had not been started , Mounting will fail 4) Test shared storage explain : In the machine mnt Data created in the directory , stay nfs And other servers on which this directory is mounted , That is, data sharing and storage has been realized
3 Description of configuration and process
3.1 NFS Description of important files related to shared file system
/etc/exports nfs Service master profile /usr/sbin/showmount see nfs Service share directory information /usr/sbin/rpcinfo see rpc Is there any house registration information in the service /var/lib/nfs/etab For viewing nfs Service default configuration information /proc/mounts nfs client mount Mount parameters ( You can view the default mount parameter information )
3.2 NFS Description of the process of service startup
3.3 NFS Profile description :
- Common configurations and parameter descriptions
[[email protected] ~]# cat /etc/exports /date 172.16.1.0/24(rw,sync) [ Catalog ] [ Client address ][ jurisdiction ]
- Catalog Directory to share , Using absolute paths , Need to belong to nfsnobody user , And pay attention to the read and write permissions
- Client address It can be a separate IP Address , Host name , domain name , Segment address ,*[ all ]
- jurisdiction [ No space between and address ], Red permission is recommended
rw Reading and writing ; ro read-only ; sync [ Default ] Write directly to the hard disk ; async Write to the hard disk asynchronously ( Write to the memory buffer first ) all_squash Compress the permissions of all users as anonymous users [nfsnobody] no_all_squash [ Default ] No user permission compression root_squash [ Default ] Compress root The user's permission is anonymous [nfsnobody] no_root_squash Uncompressed root User permissions ( dangerous , To use less ) anonuid Anonymous users uid, The default can be anongid Anonymous users gid, The default can be Be careful : At the end of the article, there is a detailed illustration of the relationship between the above parameters
- More configuration [ I don't care ]
[[email protected] ~]# cat /var/lib/nfs/etab /data 172.16.1.0/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,no_all_squash)
You can see , In addition to our configuration in export Parameters in the file , There are also many predefined parameters of the system itself , Such as creating users
3.4 NFS Shared file system permission parameter settings
- NFS The server /etc/exports The setting requires open writable permissions , That is, the sharing rights of the server side .
- NFS What the server actually wants to share NFS Directory permissions have writable w Authority
- Each machine corresponds to the existence and NFS The default configuration UID In the same UID 65534 Of nfsnobody user ( Ensure that the access rights of all clients are unified , Otherwise, each machine needs to build the same UID Users of , And cover NFS Default user configuration for )
Only if the above three conditions are met , Multiple NFS Only clients can have the ability to view 、 modify 、 Delete any other NFS The client has the right to upload files , This is particularly important in large-scale cluster environments when shared storage is used as a cluster
3.5 common problem
[[email protected] ~]# showmount -e server_ip clnt_create: PRC: Program not registered # There is a problem with the startup sequence of the service on the server clnt_create: PRC: Port mapper failure - Unable to receive: errno 111(Connetcion refused) # Firewall problem or service not started , Or the port is not open
3.6 Diagram of relationship between parameters
Last one :NFS File store
边栏推荐
- Istio practice manual | meeting the new generation of microservice architecture
- Spatial4j introduction practice
- Application analysis of video edge computing gateway easynvr in video overall monitoring solution
- 2021-11-19:[0,4,7]:0 means that the stone here has no color. If it turns red
- Property management source code based on wechat applet
- Solution of self Networking Wireless Communication intercom system in Beifeng oil and gas field
- Note sharing (5) -precautions for Oracle to MySQL
- Practical case - Tencent security hosting service MSS helped "zero accident" during the period of digital Guangdong re insurance!
- Analysis of the whole process of webapck5 core packaging principle
- MySQL architecture
随机推荐
How does smart digital operation get through offline collection and online marketing?
How to set up AI speech synthesis? What is the function of speech synthesis?
Software cost evaluation: a method for estimating software scale by fast function point method
Zoom supports automatic generation of subtitles; Shareplay goes online; Safari update leads to a large number of bugs | webrtc wind direction
Remove the cloud disk service display "continued" logo
"Ai+ education" and "Ai education": one for education and the other for Education
The Mars rescue plan has been released. The year of the tiger is limited to dolls waiting for you!
ctfhub---SSRF
Eight common errors in programming
[solution] how to realize AI automatic recognition of high altitude parabolic behavior?
Many ministries and commissions strengthened regulation, and Tencent security helped enterprises resist the "mining" Trojan horse
How to use the speech synthesis assistant? Does speech synthesis cost money?
Feasibility of importing UE4 using gltf with instances
How to develop the industrial Internet platform?
Textfree - reverse engineering of textfree
Golang gets the start timestamp and end timestamp of a past or future week or month
Talk about 11 tips for interface performance optimization
The dispute between traditional IT development and low code development is heated, and the technical development rules may be restructured?
How to access the server through the fortress machine? What if the fortress cannot access the server?
What is pension finance? What are the pension financial products?
