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 > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to set up NFS file sharing in CentOS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Nfs file sharing can solve the problem of file sharing such as pictures and attachments in the cluster environment.
Now suppose there are two machines, 192.168.1.10 and 192.168.1.11.
We use 192.168.1.10 as the server and 192.168.1.11 as the client.
I. server-side operation
1. Check to install the nfs service
Rpm-qa | grep nfs rpm-qa | grep rpcbind
If nfs-utils and rpcbind are not installed here
Yum install nfs-utils rpcbind
As shown in the picture above, the installation is successful.
two。 Set up Boot Auto start Service
Chkconfig nfs on chkconfig rpcbind on
3. Start the service
Service rpcbind start service nfs start
4. Create a shared directory
Mkdir / usr/local/jsp/www
5. Open the / etc/exports file
Vi / etc/exports
Join
/ usr/local/jsp/www * (rw,sync,no_root_squash)
*: allow all network segments to access
Rw: read and write permissions
Sync: write data synchronously to internal and hard disk
No_root_squash:nfs client shared directory user rights
If you need to specify that it can only be set for a certain network segment (for example, 192.168.1.1 / 192.168.1.192)
/ usr/local/www/ 192.168.1.* (rw,sync,no_root_squash,no_subtree_check)
You can also specify multiple network segments manually
The copy code is as follows:
/ usr/local/www/ 192.168.1.10 (rw,sync,no_root_squash,no_subtree_check) 192.168.1.11 (rw,sync,no_root_squash,no_subtree_check)
Multi-directory sharing can be done by adding multiple lines.
6. Refresh configuration takes effect immediately
Exportfs-a
At this point, you can use the showmount-e server ip to view the mount directory
Showmount-e 192.168.1.10
Second, client-side operation (the first four steps are the same as the server)
1. Check the installation of nfs
Yum install nfs-utils rpcbind
two。 Set up Boot Auto start Service
Chkconfig nfs on chkconfig rpcbind on
3. Start the service
Service rpcbind start service nfs start
4. Create a shared directory
Mkdir / usr/local/jsp/www
5. Mount directory
1) View the mountable directory
Showmount-e 192.168.1.10
2) Mount
Mount-t nfs 192.168.1.10:/usr/local/jsp/www / usr/local/jsp/www
This command has mounted the / usr/local/jsp/www directory on 10 to the client's / usr/local/jsp/www directory
If the mount times out, check the firewall configuration, but service iptables stop can temporarily turn off the firewall for testing.
3) View the mounted directory
Df-h
4) Uninstall the mounted directory
Umount / usr/local/jsp/www
6. Set up boot auto mount
Vi / etc/fstab 192.168.1.10:/usr/local/jsp/www nfs rw,tcp,intr 0 1
III. Appendix nfs Common parameters
Ro read-only access rw read-write access sync all data on request write sharing async nfs can respond to a request secure nfs send insecure nfs over a secure tcp/ip port below 1024 send wdelay over more than 1024 ports if multiple users want to write to the nfs directory, group write (default) no_wdelay if more than one user wants to write to the nfs directory, write immediately, when using async, this setting is not required. Hide does not share its subdirectory no_hide shared nfs directory in the nfs shared directory subtree_check if you share a subdirectory such as / usr/bin, force nfs to check the permissions of the parent directory (default) no_subtree_check and the above relative, do not check the parent directory permissions uid and gid mapping anonymous user anonymous of the all_squash shared file, which is suitable for public directories. No_all_squash preserves uid and gid of shared files (default) all requests of 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 uid anongid=xxx of anonymous users in nfs servers / etc/passwd files uid anongid=xxx specifies gid "CentOS of anonymous users in nfs servers / etc/passwd files NFS file shares So much for the content of "how to set". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.