配置NFS

1. 配置nfs master

yum install rpcbind nfs-utils -y

echo "/usr/local/nginx/conf/autoconfig 192.168.1.0/24(rw,no_root_squash,insecure,no_subtree_check,sync)" > /etc/exports


chmod -R 775 /usr/local/nginx/conf/autoconfig

service rpcbind start
service nfs start

chkconfig nfs on
chkconfig rpcbind on
  • no_root_squash:登入 NFS 主机使用分享目录的使用者,如果是 root 的话,那么对于这个分享的目录来说,他就具有 root 的权限!这个项目『极不安全』,不建议使用!
  • root_squash:在登入 NFS 主机使用分享之目录的使用者如果是 root 时,那么这个使用者的权限将被压缩成为匿名使用者,通常他的 UID 与 GID 都会变成 nobody 那个系统账号的身份。
  • insecure 表示NFS通过1024以上的端口进行发送
  • no_subtree_check 表示不检查父目录的权限
  • sync 表示所有数据在请求时写入共享目录
  • ro 是read only,只读模式
  • rw 是read and write 可以读和写

2. 配置nfs slave

yum install nfs-utils -y

chkconfig nfs on

mkdir -p /usr/local/nginx/conf/autoconfig

mount -t nfs 172.31.43.200:/usr/local/nginx/conf/autoconfig /usr/local/nginx/conf/autoconfig

如果希望slave拥有只读的权限

mount -t nfs -o ro 172.31.43.200:/usr/local/nginx/conf/autoconfig /usr/local/nginx/conf/autoconfig

重新挂载的命令

mount -o remount -t nfs 172.31.43.200:/usr/local/nginx/conf/autoconfig /usr/local/nginx/conf/autoconfig
原文地址:https://www.cnblogs.com/faberbeta/p/linux-shell016.html