# # Path: Network/File systems/NFS server
# # Description: number of threads for kernel nfs server
# # Type: integer
# # Default: 4
# # ServiceRestart: nfsserver
#
# the kernel nfs-server supports multiple server threads
#
USE_KERNEL_NFSD_NUMBER="4"
# # Path: Network/File systems/NFS server
# # Description: use fixed port number for mountd
# # Type: integer
# # Default: ""
# # ServiceRestart: nfsserver
#
# Only set this if you want to start mountd on a fixed
# port instead of the port assigned by rpc. Only for use
# to export nfs-filesystems through firewalls.
#
MOUNTD_PORT=" xxx " set to port opened in firewall!
# # Path: Network/File systems/NFS server
# # Description: GSS security for NFS
# # Type: yesno
# # Default: yes
# # ServiceRestart: nfs nfsserver
#
# Enable RPCSEC_GSS security for NFS (yes/no)
#
NFS_SECURITY_GSS="no"
# # Path: Network/File systems/NFS server
# # Description: NFSv4 protocol support
# # Type: yesno
# # Default: yes
# # ServiceRestart: nfs nfsserver
#
# Enable NFSv4 support (yes/no)
#
NFS4_SUPPORT="no"
# # Path: Network/File systems/NFS server
# # Description: NFSv4 server minor version
# # Type: integer
# # Default: 0
# # ServiceRestart: nfsserver
#
# Select NFSv4 minor version for server to support (0, 1).
# If '1' is selected, both NFSv4.0 and NFSv4.1 will be supported.
NFS4_SERVER_MINOR_VERSION="0"
# # Path: Network/File systems/NFS server
# # Description: Network Status Monitor options
# # Type: string
# # Default: ""
#
# If a fixed port should be used to send reboot notification
# messages to other systems, that port should be given
# here as "-p portnumber".
#
SM_NOTIFY_OPTIONS="-p xxxxx" set to port opened in firewall
# # Path: Network/File systems/NFS server
# # Description: Always start NFS services
# # Type: yesno
# # Default: no
# # ServiceRestart nfs
#
# Always start NFS services (gssd, idmapd), not only if
# there are nfs mounts in /etc/fstab. This is likely to be
# needed if you use an automounter for NFS.
#
NFS_START_SERVICES=""
# # Path: Network/File systems/NFS server
# # Description: Port rpc.statd should listen on
# # Type: integer
# # Default: ""
# # ServiceRestart: nfsserver
#
# Statd will normally choose a random port to listen on and
# SuSE-Firewall is able to detect which port and allow for it.
# If you have another firewall, you may want to set a fixed
# port number which can then be opened in that firewall.
#
STATD_PORT="xxxxx" set to port opened in firewall
# # Path: Network/File systems/NFS server
# # Description: Hostname used by rpc.statd
# # Type: string
# # Default: ""
# # ServiceRestart: nfsserver
#
# statd will normally use the system hostname in status
# monitoring conversations with other hosts. If a different
# host name should be used, as can be useful with fail-over
# configurations, that name should be given here.
#
STATD_HOSTNAME=""
# # Path: Network/File systems/NFS server
# # Description: TCP Port that lockd should listen on
# # Type: integer
# # Default: ""
# # ServiceRestart: nfsserver
#
# Lockd will normally choose a random port to listen on and
# SuSE-Firewall is able to detect which port and allow for it.
# If you have another firewall, you may want to set a fixed
# port number which can then be opened in that firewall.
# lockd opens a UDP and a TCP port. This setting only affect
# the TCP port.
#
LOCKD_TCPPORT="xxxxx" set to port opened in firewall
# # Path: Network/File systems/NFS server
# # Description: UDP Port that lockd should listen on
# # Type: integer
# # Default: ""
# # ServiceRestart: nfsserver
#
# Lockd will normally choose a random port to listen on and
# SuSE-Firewall is able to detect which port and allow for it.
# If you have another firewall, you may want to set a fixed
# port number which can then be opened in that firewall.
# lockd opens a UDP and a TCP port. This setting only affect
# the UDP port.
#
LOCKD_UDPPORT="xxxxx" set to port opened in firewall
# # Path: Network/File systems/NFS server
# # Description: Lease time for NFSv4 leases
# # Type: integer
# # Default: ""
#
# Set the lease time for the NFSv4 server. This allows new locks
# to be taken sooner after a server restart, so it is useful for
# servers which need to recover quickly after a failure, particularly
# in fail-over configurations. Reducing the lease time can be a
# problem is some clients connect over high latency networks.
# The default is 90 seconds. A number like 15 might be appropriate
# in a fail-over configuration with all clients on well connected
# low latency links.
NFSV4LEASETIME=""
# # Path: Network/File systems/NFS server
# # Description: Alternate mount point for rpc_pipefs filesystem
# # Type: string
# # Default: ""
#
# In a high-availabilty configuration it is possible that /var/lib/nfs
# is redirected so some shared storage and so it is not convenient to
# mount the rpc_pipefs filesystem at /var/lib/nfs/rpc_pipefs. In that
# case an alternate mount point can be given here.
RPC_PIPEFS_DIR=""
# # Path: Network/File systems/NFS server
# # Description: Options for svcgssd
# # Type: string
# # Default: ""
#
# Normally svcgssd does not require any option. However in a
# high-availabilty configuration it can be useful to pass "-n"
# to guide the choice of default credential. To allow for that
# case or any other requiring options ot svcgssd, they can
# be specified here.
SVCGSSD_OPTIONS=""
# # Path: Network/File systems/NFS server
# # Description: Extra options for nfsd
# # Type: string
# # Default: ""
#
# This setting allows extra options to be specified for NFSD, such as
# -H <shared_hostname> in a high-availability configuration.
NFSD_OPTIONS=""
# # Path: Network/File systems/NFS server
# # Description: Extra options for gssd
# # Type: string
# # Default: ""
#
# Normally gssd does not require any options. In some circumstances,
# -n, -l or other options might be useful. See "man 8 rpc.gssd" for
# details. Those options can be set here.
GSSD_OPTIONS=""
# # Path: Network/File systems/NFS server
# # Description: Extra options for mountd
# # Type: string
# # Default: ""
#
# Normally mountd does not require any options. In some circumstances,
# -n, -t, -g or other options might be useful. See "man 8 rpc.mountd" for
# details. Those options can be set here.
# -p or -N should be set using MOUNTD_PORT or NFS4_SUPPORT rather than
# this option.
MOUNTD_OPTIONS=""
# # Path: Network/File systems/NFS server
# # Description: Avoid DNS lookups for kerberos principal
# # Type: yesno
# # Default: no
# # ServiceRestart: gssd
#
# Avoid DNS lookups when determining kerberos identity
# of NFS server (yes/no)
# "yes" is safest, but "no" might be needed to preserve
# correct behaviour at sites that don't use
# Fully Qualified Domain Names when mounting NFS Shares.
#
NFS_GSSD_AVOID_DNS="no"
旧版本的 NFS (v2/v3) 可以在没有锁的情况下使用。为了支持锁定,在服务器上使用了一个单独的锁定守护进程,与 nfsd 并驾齐驱。
对于 NFSv4(您已标记问题),锁定是协议的必需部分,并且单独的锁定守护程序不用于 v4 服务。
如果你有一个 nfsv4 挂载,你应该能够锁定一个文件,就像你在本地文件系统上锁定一个文件一样。
Unix 使用咨询锁定,在客户端强制执行,而不是文件系统(这是 Windows 倾向于这样做的方式)。这意味着您的所有客户都需要参与锁定。
如果您的客户在访问文件之前请求锁定,那么一切都会好起来的。只有在其他客户端释放锁之后,其他客户端才能获得锁。
fcntl
本地和 NFS 文件系统通常都支持调用。查看Wikipedia 上的 UNIX 中的文件锁定了解一些背景知识。
NFS 锁是 NFS 进程的一部分。你不安装它。此外,这并不像你想的那样工作。如果你使用它,一个 MUTEX 锁将不会传递给所有服务器。我见过的唯一能做到这一点的软件是 VERITAS。
我不能专门针对 debian 告诉您,但这是我
/etc/sysconfig/nfs
来自 SLES 11.4 的文件(我认为它使用的是 NFS v3)。“nfs 锁定守护程序”应该是安装的 nfs 包所固有的,并且应该可以正常工作。NFS 的一个依赖项是带有
rpc.mountd
andrpc.statd
和的 RPCrpc.lockd
。因此,如果 NFS 正确安装(以及它所需的依赖项,例如 RPC 和 Portmap),它应该可以工作,只要您关闭防火墙,或配置为lockd
和mountd
. 如果您不指定静态端口,则 NFS 将在每次启动时随机选择这些端口 [在引导期间]。使用防火墙[通常默认情况下],您将永远无法解释这些随机选择的端口号,这将阻止锁定机制每次都起作用。请注意,我的信息不适用于 NFSv4。