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)06/02 Report--
Editor to share with you how to build CentOS7 server NFS server file sharing, I hope you will learn something after reading this article, let's discuss it together!
NFS server file sharing
When multiple servers are clustered, because only one server uploads file attachments when uploading, there will be attachments that other servers cannot find. At this point, you need to share the folder uploaded by attachments so that all servers in the cluster can access the uploaded attachments.
Server side
Turn off the firewall because the NFS port rules are complex and difficult to set.
Install nfs
Yum install nfs-utils rpcbind
Configure nfs: vim / etc/exports
/ data/share 192.168.0.10 (rw,sync,all_squash)
Where the ip address refers to the IP that can access the share. If multiple IP access is allowed, 192.168.0.* can be used.
Sharing multiple folders can set up multiple rows.
About permissions
The user of the shared directory is nfsnobody, which can be set (rw,sync,all_squash,anonuid=xxx,anongid=xxx)
Or set the permissions of the shared directory to 777: chmod 777 / data/share
# Let the configuration take effect after modifying exports exportfs-arv# starts rpcbind service systemctl start rpcbindsystemctl enable rpcbind# starts nfs service systemctl start nfssystemctl enable nfs# check whether the showmount-e client is configured # start rpcbind service systemctl start rpcbindsystemctl enable rpcbindshowmount-e 192.168.0.2 mount mount-t nfs 192.168.0.20:/data/share / mnt/nfs# unmount umount / mnt/share boot mount
Modify the file vim / etc/rc.d/rc.local by adding the following code:
Mount-t nfs-o nosuid,noexec,nodev,rw,bg,soft,rsize=32768,wsize=32768 192.168.0.20:/data/share / mnt/nfs
If the file does not have execute permissions, you need to increase the execute permissions:
Chmod + x / etc/rc.d/rc.local automatically mounts autofs
Auto-mount cannot see the folder when it is not in use, and it will be automatically mounted and displayed only when you enter the folder with or with the command. Therefore, it is not very convenient to use for deployment.
Boot mount and automatic mount choose one of the two and cannot be used at the same time. For deployment, boot mount is generally used. If it is just a simple file sharing, you can use autofs.
# install yum install autofs
Configuration file vim / etc/auto.master, add the code:
/ mnt/nfs / etc/auto.nfs
Create the file vim / etc/auto.nfs, which is as follows:
Public-rw,bg,soft,rsize=32768,wsize=32768 192.168.0.20:/data/share
The corresponding mount directory is / mnt/nfs/public. Do not create these folders manually. Autofs will handle them automatically.
# start systemctl start autofs# start self-start systemctl enable autofs# stop systemctl stop autofs# close self-start systemctl disable autofs after reading this article, I believe you have some understanding of "how to set up NFS server file sharing on CentOS7 server". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!
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.