NFS 共享存储与LVS

NFS 共享存储与LVS

NFS发布共享资源
NFS的实现依赖于RPC (远程过程调用)机制,以完成远程到本地的映射过程,
需要安装nfs-utils rpcbind 软件包提供NFS共享服务,前者用于NFS共享发布和访问,
后者用于RPC支持。
启动服务时先启动rpcbind 再启动nfs
=====实验===
3台机器
主机1,主机2 为web节点,主机3为NFS服务器
===
所有服务器关闭安全机制防火墙
所有服务器安装 nfs-utils rpcbind
所有服务都设置为开机自启动
systemctl enable rpcbind
systemctl enable nfs
=====
主机3 NFS 66   (nfs的配置文件/etc/exports ,默认是是空文件)
vim /etc/exports
/opt/wwwroot 192.168.200.0/24(rw,sync,no_root_squash)
保存退出   ///opt/wwwroot  表示共享目录  no_root_squash 表示当客户机以root身份访问时赋予本地root权限。
////默认是root_squash 表示将作为nfsnobody用户降权对待
mkdir /opt/wwwroot
systemctl restart rpcbind
systemctl restart nfs
showmount -e   //查看共享
echo "11111111111" > /opt/wwwroot /index.html
===================
主机1 67
showmount -e  192.168.200.66
systemctl start rpcbind
systemctl start nfs
mount 191.168.200.66:/opt/wwwroot  /var/www/html/
mount | tail -1   //查看挂载   等同于 tail -1 /etc/mtab  
cat  /var/www/html/index.html   //测试
设置自动挂载
192.168.200.66:/opt/wwwroot   /war/www/html nfs defaults,_netdev 0 0
主机2 68
showmount -e  192.168.200.66
systemctl start rpcbind
systemctl start nfs
mount 191.168.200.66:/opt/wwwroot  /var/www/html/
mount | tail -1   //查看挂载   等同于 tail -1 /etc/mtab  
cat  /var/www/html/index.html
设置自动挂载
192.168.200.66:/opt/wwwroot   /war/www/html nfs defaults,_netdev 0 0
===========================
在浏览器中 输入调度器的IP 进行查看 192.168.200.254
在主机4 调度器中ipvsadm -Ln 查看
 ========完成==========

猜你喜欢

转载自www.cnblogs.com/elin989898/p/11941663.html