In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to solve the problem of NFS stuck. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something from this article.
Recently, nfs was used to store files, but there was a problem on the client node.
When using df-h, the system just gets stuck.
Later, Baidu found that many people encountered this kind of problem on the Internet. Because the server of nfs is actually dead, but the client still exists. So this will happen, and here is a copy of a quotation from a great god:
The nfs client has been stuck before. Umount-f / mnt prompts device is busy, and attempts to access the mount directory, df-h and other operations will cause the terminal to get stuck, and ctrl+c cannot be forcibly exited.
At that time, I was too busy to catch up and did not study the problem. Recently take the time to do some research and learn the optimization of nfs by the way.
The reason for this is that the nfs server / network is down, and the nfs client defaults to the hard-mount option instead of soft-mount. The difference between them is that
Soft-mount: the number of times set by the retrans to retry when the client loads the NFS unsuccessfully. If the retrans is unsuccessful, the operation is abandoned and the error message "Connect time out" is returned
Hard-mount: when the client loads the NFS unsuccessfully, retry until the NFS server responds. Hard-mount is the default value for the system. When selecting hard-mount, it is best to select intr at the same time to allow you to interrupt the call request of the system and avoid causing the system to hang. When the NFS server cannot respond to the hard-mount request from the NFS client, the NFS client displays the
"NFS server hostname not responding, still trying"
The following is a list of mount parameters related to nfs
(1)-a: Mount all the paths listed in / etc/fstab.
(2)-t: the type that requires mount, such as nfs, etc.
(3)-r: set the path of mount to read only.
(4)-v mount: every operation of the process has a message returned to the screen.
(5) rsize=n: the number of bytes used by NFS when the NFS server reads the file. The default value is 4096 bytes.
(6) wsize=n: the number of bytes used by NFS when writing files to the NFS server. The default value is 4096 bytes.
(7) timeo=n: the number of 7 seconds taken from the timeout to the first retransmission. The default value is 7 seconds.
(8) retry=n: the number of attempts that can be made before abandoning the background mount operation. The default value is 7,000.
(9) soft: Mount the system by soft mount. If the Client request is not answered, the request will be rerequested and an error message will be returned.
(10) hard: Mount the system by hard mount. This value is the default value. Repeat the request until the NFS server responds.
(11) intr: allows NFS to interrupt file operations and return values to the program that calls it. File operations are not allowed to be interrupted by default.
(12) fg: repeat mounting at the prompt all the time.
(13) bg: if the first mount of the file system fails, continue to attempt to mount the file system in the background. The default value is that it will not be processed in the background after failure.
(14) tcp: use TCP for mounting the file system instead of the default UDP.
Such as # mount-t nfs-o soft 192.168.1.2:/home/nfs / mnt
As for the choice of transmission size, you can actually test it:
Time dd if=/dev/zero of=/mnt/nfs.dat bs=16k count=16384
That is, write 16384 16KB blocks to the nfs.dat file on the nfs server (there is also experience that the file size can be set to 2 times the memory of the nfs server).
Get the output such as:
1638440 blocks were output
User 0m0.200s
Output 6653550 blocks
User 0m0.420s
192.168.1.4:/mnt / home/nfs nfs rsize=8192,wsize=8192,timeo=10,intr
Re-mount the nfs server, adjust the read and write block size and repeat the above process to find the best transmission size.
Troubleshooting NFS Server
Troubleshooting ideas:
There is a failure in NFS, which can be checked from the following aspects.
(1) whether the load of the NFS client and server is too high, and whether the network between the server and the client is normal.
(2) the correctness of / etc/exports file.
(3) restart the NFS or portmap service if necessary.
Restart portmap and NFS by running the following command:
Service portmap restart
Service nfs start
(4) check whether the syntax of the mount command or / etc/fstab in the client is correct.
(5) check whether the kernel supports NFS and RPC services.
The options for a normal kernel are CONFIG_NFS_FS=m, CONFIG_NFS_V3=y, CONFIG_NFSD = m, CONFIG_NFSD_V3=y, and CONFIG_SUNRPC=m.
We can use the common network connection and testing tools ping and tracerroute to test whether the network connection and speed are normal, which is the basis of the function of NFS. The rpcinfo command is used to display the RPC information of the system
Generally, the-p parameter is used to list the RPC services of a host. When you check the server with the rpcinfo-p command, you should see portmapper, status, mountd nfs, and nlockmgr. When checking the client with this command, you should
You should at least see the portmapper service.
Use the nfsstat command to view the NFS server status
The nfsstat command displays statistics about NFS and the remote procedure call (RPC) interface to the kernel, which can also be reinitialized using this command. If no flag is given, the default is the nfsstat-csnr command. Use this command to display each piece of information, but you cannot reinitialize any information.
The main parameters of the nfsstat command are as follows.
(1)-b: displays additional statistics for the NFS V4 server.
(2) c: displays only the NFS and RPC information on the client side, allowing the user to view only the reports of the client data. The nfsstat command provides information about the number of RPC and NFS calls sent and rejected by the client.
To display only the client NFS or RPC information, combine this parameter with the-n or-r parameter.
(3)-d: displays information related to NFS V4 authorization.
(4)-g: displays RPCSEC_GSS information.
(5)-m: displays statistics for each NFS file system, the file system and server name, address, installation flag, current read and write size, and retransmission count
(6)-n: displays NFS information for clients and servers. To display only NFS client or server information, combine this parameter with the-c and-s parameters.
(7)-r: displays RPC information.
(8)-s: displays server information.
(9)-t: displays statistics related to the conversion requests of the NFS identity mapping subsystem. To display only NFS client or server information, combine the-c and-s options.
(10)-4: when combined with the-c,-n,-s, or-z parameters, it contains information about the NFS V4 client or server, as well as existing NFS V2 and V3 data.
(11)-z: reinitialize statistics. This parameter is for root users only and can be combined with any one of those flags into a zero special collection of statistics after displaying the flags above.
To display information about the number of RPC and NFS calls sent and rejected by the client, enter:
Nfsstat-c
To display and print information related to client NFS calls, enter the following command:
Nfsstat-cn
To display and print information about RPC calls for clients and servers, enter the following command:
Nfsstat-r
To display information about the number of RPC and NFS calls received and rejected by the server, enter the following command:
Nfsstat-s
After reading the above, do you have any further understanding of how to solve the problem of NFS stuck? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.