让 nfs 4 在 redhat/centos 7 中运行

让 nfs 4 在 redhat/centos 7 中运行

运行 RHEL 7.9 并尝试在 LAN 上的几台服务器之间执行 nfs。我总是将 nfs v3 作为挂载。有没有办法让最新版本的 nfs 发生,我认为根据 4.2 /etc/nfs.conf

在不同 LAN 上的一台服务器上,我看到

mount | grep bkup

bkupserver:/bkup on /bkup type nfs4 (rw,nosuid,noexec,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.2,local_lock=none,addr=192.168.1.1)

但我不知道为什么会这样版本=4.1有而不是4.2。

但我真正的问题是我的其他服务器总是说章节=3同时我不知道为什么。

我注意到我的服务器之间唯一不同的是 nfsv4 工作服务器具有/etc/exports/ /bkup *(rw,no_root_squash) versus my nfsv3 servers havingetc/exports as/bkup *(rw, async, no_root_squash)`。

导出选项本身是否会导致或阻止 nfs 版本的发生?

下面是我的“/etc/nfs.conf”供参考,我一直在获取 nfs v3。我/etc/sysconfig/nfs已编辑以仅匹配端口号,如下所示。只是注意到我的服务器正在执行 vers=4.1,它的“/etc/nfs.conf”未受影响,我只编辑/etc/sysconfig/nfs以声明端口号,以便我可以在防火墙中打开。

# This is a general configuration for the
# NFS daemons and tools; this is /etc/nfs.conf in RHEL 7.9
#
#[general]
# pipefs-directory=/var/lib/nfs/rpc_pipefs
#
#[exportfs]
# debug=0
#
#[gssd]
# verbosity=0
# rpc-verbosity=0
# use-memcache=0
# use-machine-creds=1
# avoid-dns=1
# limit-to-legacy-enctypes=0
# context-timeout=0
# rpc-timeout=5
# keytab-file=/etc/krb5.keytab
# cred-cache-directory=
# preferred-realm=
#
[lockd]
port=4001
udp-port=4001
#
#[mountd]
# debug=0
# manage-gids=n
# descriptors=0
port=4002
threads=8
# reverse-lookup=n
# state-directory-path=/var/lib/nfs
# ha-callout=
#
#[nfsdcltrack]
# debug=0
# storagedir=/var/lib/nfs/nfsdcltrack
#
[nfsd]
# debug=0
threads=8
# host=
port=4003
# grace-time=90
# lease-time=90
udp=y
tcp=y
# vers2=n
vers3=y
vers4=y
vers4.0=y
vers4.1=y
vers4.2=y
rdma=y
#
#[statd]
# debug=0
port=4004
outgoing-port=4005
# name=
# state-directory-path=/var/lib/nfs/statd
# ha-callout=
# no-notify=0
#
[sm-notify]
# debug=0
# force=0
# retry-time=900
outgoing-port=4006
# outgoing-addr=
# lift-grace=y

答案1

  • 如果连接到 CentOS 7.9 NFS 服务器的系统早于 CentOS 7.0,它们将只能使用 NFS 4.1 或 NFS 3 进行连接。

  • 要强制系统尝试 NFS4 和版本 4.2,请在 mount 命令中使用以下选项:

#mount -t nfs4 -o vers=4.2,rw,no_root_squash bkupserver:/bkup /bkup
  • 确保您已在防火墙上为 NFS V4 打开正确的端口
#firewall-cmd --permanent --add-service=nfs
#filewall-cmd --permanent --add-service=rpc-bind
#firewall-cmd --reload

为了完整起见,如上所述,您需要确保启用版本 v4.2。

参见参考资料:https://access.redhat.com/solutions/2325171

相关内容