本文已在本人博客https://www.nsxsg.com/archives/90首发
文章目录
多机部署之NFS的安装与配置
NFS即网络文件系统,说的通俗一点就是网络共享文件。它能够让不同的服务器共享同一个资源,这个在集群部署中普遍运用。
-
安装nfs
yum install -y nfs-utils yum install -y rpcbind #适用centos 6 yum install -y portmap #适用centos 5 -
启动NFS服务,一定要先启动rpcbind,后启动nfs
/etc/init.d/rpcbind start /etc/init.d/nfs start -
在资源服务器(服务器端)上配置NFS,修改
/etc/exports/data/httpd/www/public 客户端ip(rw,sync,no_root_squash) /data/httpd/www/themes 客户端ip(rw,sync,no_root_squash) /data/httpd/www/wap_themes 客户端ip(rw,sync,no_root_squash) #修改好之后执行命令 exportfs -rv查看是否成功
showmount -e 服务器端ip Export list for 服务器端ip /data/httpd/www/public 客户端ip /data/httpd/www/themes 客户端ip /data/httpd/www/wap_themes 客户端ip -
web服务器(客户端)挂载资源服务器的资源
mount 服务器端ip:/data/httpd/www/public /data/httpd/www/public mount 服务器端ip:/data/httpd/www/themes /data/httpd/www/themes mount 服务器端ip:/data/httpd/www/wap_themes /data/httpd/www/wap_themes -
防止重启服务器忘记挂载
vi /etc/rc.local mount 服务器端ip:/data/httpd/www/public /data/httpd/www/public mount 服务器端ip:/data/httpd/www/themes /data/httpd/www/themes mount 服务器端ip:/data/httpd/www/wap_themes /data/httpd/www/wap_themes -
重启服务
先启动:service rpcbind start 再启动:service nfs start
先关闭:service nfs stop 再关闭:service rpcbind stop
本文详细介绍了如何在CentOS环境下安装与配置NFS(网络文件系统),实现多机部署中的资源共享。从安装必要软件包到配置服务器端与客户端的具体步骤,包括修改配置文件、启动服务、验证连接及持久化挂载设置。
1921

被折叠的 条评论
为什么被折叠?



