In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you about how to achieve nfs mounting. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
NFS (Network File System), the network file system, is one of the file systems supported by FreeBSD, which allows computers in the network to share resources over the TCP/IP network. In the application of NFS, the client application of the local NFS can read and write files located on the remote NFS server transparently, just like accessing the local file. The two linux environments for this article are CentOS and Ubuntu, respectively, and the other versions are similar. Mount / home/dhcc/nfs under Ubuntu to CentOS / home/shao/nfs.
Ubuntu:
1. Install and configure NFS server
Sudo apt-get install nfs-kernel-server nfs-common
two。 Configuration parameters
Vim / etc/exports
Add a line at the end of the file, be careful not to add comments
/ home/dhcc/nfs * (rw,sync,no_root_squash) # this directory is the root directory of the nfs service, and * means all network segments are allowed to access. You can also use a specific IP. The parameters are described at the end.
3. Create a nfs directory (skip this step if you have configured an existing target)
Sudo mkdir / home/dhcc/nfs
4. Check whether the configuration is in effect
Exportfs-r # update configuration
Showmount-e
If it takes effect, it will be displayed.
Export list for Ubuntu:
Home/dhcc/nfs
5. Restart the nfs service
/ etc/init.d/nfs-kernel-server restart
CentOS:
1. Create a mount directory (skip if it already exists)
Mkdir / data
two。 Install nfs-utils
Yum install nfs-utils
Mount-t nfs cpnas01.cloud.cnpc:/fs_nfs016 / data
Vi / etc/fstab
Cpnas01.cloud.cnpc:/fs_nfs016 / data nfs rw,tcp,intr 0 0
Vim / etc/rc.d/rc.local
Sudo mount-t nfs cpnas01.cloud.cnpc:/fs_nfs016 / data
2.mount direct mount
The ip of mount-t nfs 10.18.105.116:/home/dhcc/nfs / home/shao/nfs # Ubuntu is 10.18.105.116
3. Power on and mount automatically
Vim / etc/rc.local
Add a row
Sudo mount-t nfs 10.18.105.116:/home/dhcc/nfs / home/shao/nfs
If an mount.nfs:access denied by server while mounting problem occurs, you can try to resolve it in the following ways:
1. Modify the permissions of the nfs directory to be mounted
Chmod 755 / home/dhcc/nfs
two。 If the port number is greater than 1024, you need to add the insecure option to the configuration file (/ etc/exports):
Vim / etc/exports
Add a line at the end of the file
/ home/dhcc/nfs * (insecure,rw,sync,no_root_squash)
3. Modify / etc/sysconfig/nfs file
# Turn off v2 and v3 protocol support
# RPCNFSDARGS= "- N2-N3"
# Turn off v4 protocol support
# RPCNFSDARGS= "- N4" / * remove the # sign from this sentence * /
NFS is divided into three versions, namely NFS-2 NFS-3 NFS-4. The configuration file turns off these three NFS versions by default, and we just need to open NFS-4.
Appendix: common parameters of NFS are as follows:
Ro read-only access
Rw read-write access sync all data is written to the share on request
Async nfs can respond to requests before writing data
Secure nfs is sent over a secure TCP/IP port below 1024
Insecure nfs is sent over more than 1024 ports
Wdelay if multiple users want to write to the nfs directory, write in groups (default)
No_wdelay if more than one user wants to write to the nfs directory, it is written immediately, and this setting is not required when using async.
Hide does not share its subdirectories in the nfs shared directory
A subdirectory of the no_hide shared nfs directory
Subtree_check forces nfs to check the permissions of the parent directory when sharing a subdirectory such as / usr/bin (default)
No_subtree_check is relative to the above, and the permissions of the parent directory are not checked
The UID and GID of all_squash shared files map the anonymous user anonymous, which is suitable for public directories.
No_all_squash retains UID and GID of shared files (default)
All requests from root_squash root users are mapped to the same permissions as anonymous users (default)
No_root_squas root users have full administrative access to the root directory
Anonuid=xxx specifies the UID of anonymous users in the nfs server / etc/passwd file
Anongid=xxx specifies the GID of anonymous users in the nfs server / etc/passwd file
The above is the editor for you to share how to achieve nfs mount, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.