In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Cloud Computing Learning Route sharing for good programmers: about NFS
Project name: configure back-end storage for Web Server in the cluster
NFS:Network File System network file system, a protocol for sharing files between Unix systems
The client of NFS is mainly Linux.
Support simultaneous mounting of multiple nodes and concurrent writing
=
Nas 192.168.122.59
Web1 192.168.122.85
Web2 192.168.122.166
Web3 192.168.122.111
Nas web1 web2 web3
# sed-ri'/ ^ SELINUX=/cSELINUX=disabled' / etc/selinux/config
# setenforce 0
Centos6
# iptables-F
# service iptables save
Centos7
# systemctl stop firewalld
# systemctl disable firewalld
# vim / etc/hosts [optional]
192.168.122.59 nas
192.168.122.85 web1
192.168.122.166 web2
192.168.122.111 web3
NFS
1. Install softwar
Yum-y install nfs-utils (file system provided by the main package)
Yum-y install rpcbind (provides rpc protocol)
two。 Start services-> both services must be enabled at the same time
Systemctl start nfs
Systemctl start rpcbind
1. Nas (storage side)
[root@nas ~] # yum-y install nfs-utils
[root@nas ~] # mkdir / webdata / / Storage website code!
[root@nas ~] # echo "nfs test..." > / webdata/index.html
[root@nas ~] # vim / etc/exports
/ webdata 192.168.122.0 root 24 (rw,sync,no_root_squash) / / do not suppress root (when the client uses root to mount, it also has root permission) Mount root, and also maintain root permission
[root@nas ~] # systemctl start nfs-server
[root@nas ~] # systemctl enable nfs-server
[root@nas] # exportfs-v
/ webdata 192.168.122.0 take 24 (rw,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash)
His
II. Web1 web2 web3 client
Take web1 as an example:
[root@web1 ~] # yum-y install nfs-utils httpd
[root@web1 ~] # systemctl start httpd
[root@web1 ~] # systemctl enable httpd
Httpd
1. View storage side shares [optional]
[root@web1] # showmount-e nas
Export list for nas:
/ webdata 192.168.122.0/24
Ps-ef | grep nfs
two。 Manual mount [optional]
[root@web1] # mount-t nfs nas:/webdata / var/www/html/
[root@web1 ~] # umount / var/www/html/
3. Automatically mount to the home directory of the website
[root@web1 ~] # vim / etc/fstab
Nas:/webdata / var/www/html nfs defaults 0 0
[root@web1] # mount-a
4. View mount
[root@web1 ~] # df
Nas:/webdata 7923136 692416 6821568 10% / var/www/html
[root@web1 ~] # ls / var/www/html/
Index.html
5. Web2 web3 ditto
Third, test website access
# firefox 192.168.122.85
# firefox 192.168.122.111
# firefox 192.168.122.166
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.