man sm-notify(sm-notify Chinese command manual )
My translation collection ：http://www.cnblogs.com/f-ck-need-u/p/7048359.html
sm-notify The command is used to send a restart notification message to NFS Opposite end , It plays an important role in the process of lock state recovery . Most of the descriptions for this command and rpc.statd All the same .
SM-NOTIFY(8) System Manager's Manual SM-NOTIFY(8) NAME sm-notify -
Send system restart notification to NFS End to end tools SYNOPSIS/usr/sbin/sm-notify [-dfn] [-m minutes] [-v name] [-p
notify-port] [-P path] DESCRIPTION A file lock is not part of the persistent file system state . Therefore, the state of the lock is lost when the host restarts .
When the remote host restarts , The network file system must be able to detect the loss of lock state . When NFS When the client restarts ,NFS service
The client must release all file locks requested by the client . After the server restarts , The client must be able to alert the server that it is requesting Please lock all files of .
about NFSv2 and NFSv3, Using the network status monitor Network Status Monitor(NSM) Agreement to notify NFS Opposite end about weight
What happened . stay Linux upper ,NSM The service process consists of two independent user space programs ： ● rpc.statd
This daemon is used to listen for restart messages from other hosts , And manage the list of hosts that need to be notified when the local host restarts . ● sm-notify An auxiliary program , Used to notify when the local system restarts NFS Opposite end .
( translator's note ： in other words rpc.statd Is the recipient of the restart message , and sm-notify Is the informer of information ) local NFS Lock manager (NFS lock
manager,NLM) It's local rpc.statd Warn each remote peer in the list Status needs to be monitored . When the local system restarts ,sm-
notify The command will notify the NSM The service is about restarting itself matter . When the remote host restarts , Remote peer sm-
notify Notify local rcp.statd, This information is then communicated locally NFS Lock manager , The local lock manager will maintain the lock of the file corresponding to the restart end . NSM OPERATION IN
DETAIL NFS The first file lock interaction between the client and the server causes the NLM Get in touch with their local counterparts NSM Service to
Store their peer information . stay Linux upper , That is to let the local manager contact rpc.statd Daemons .
rpc.statd Will NFS The peer information is recorded on persistent storage . This information describes how to contact the remote if the local system restarts
Opposite end , How to identify the information that the peer reports it is restarting , And how to notify the peer when it says it has been restarted NLM.
Each client sends a file lock request called a client caller_name Host name of .NFS The server can make
Use this host name to send asynchrony to the client GRANT call , Or notify the client that it has been restarted . Linux
NFS The server can transfer the caller_name Or the network address of the client rpc.statd. In order to comply NSM
agreement , This name or address is called the peer mon_name. in addition , The local lock manager will tell rpc.statd Its own host name , In order to comply NSM agreement , This host name is called my_name.
stay NFS in ,NFS The server does not inform the client of its host name interaction . therefore NFS The client actually doesn't know the server
Of mon_name, In spite of SM_NOTIFY It will be used in the request .Linux NFS The client is obtained from the mount command by using the
The host name or address of the server to identify the NFS Server side . Reboot notification When the local system restarts , Local sm-
notify The command reads the list of monitoring peers from persistent storage , And send SM_NOTIFY request
For each remote peer in the list NSM Service process , It uses mon_name String to specify the destination . To identify which owner The machine has been restarted , The rebooted host will use the sm-
notify Command sending my_name character string . long-range rpc.statd Will use The string matches its counterpart in its watch list to find the send SM_NOTIFY Requested host .
If rpc.statd No match was found in its monitoring list for the received SM_NOTIFY The opposite end of the request , The notification is not forwarded
To local lock manager . in addition , Each peer has a unique one 32 Bit integer NSM Status code , After each restart ,sm-notify life
Make it collide and repeat .rpc.statd Use this number to distinguish between a restart and a notification replay . NFS Part of lock recovery is to rediscover which peer needs to be monitored again . After each restart ,sm-
notify Orders will be cleared Monitor list on empty persistent storage . OPTIONS-d take sm-notify Attached to its control terminal and run in the foreground , So that the notification program can be directly monitored . -f
Send notification information , Even after the last system restart sm-notify It's been run once . -m retry-time
Specifies when no response is received , Resend the notification within this time period , The unit is minutes . If not specified , be sm-notify attempt stay 15 Keep sending notifications for minutes . Designated as 0 Time ,sm-
notify Notification will be sent unlimited , Until it's manual kill fall . The notification will be reissued in the following situations ： fail in send , Remote host not responding , long-range NSM Service not registered , long-range mon_name
The resolution is IP Address DNS error . Only when a valid response from the remote host is received , This remote host will be removed from the notification list . however SM_NOTIFY in One result remains .sm-
notify There is no way for the remote host to identify the sender and whether it has been recovered correctly Locked state .-n prevent sm-notify Update local system NSM Status number . -p port
appoint sm-notify Source port number when sending system restart notification . If not specified , The random temporary port number is used . This option may be used when notifying that a firewall needs to be traversed . -P,
--state-directory-path pathname appoint NSM The parent directory of the path where the state information is saved . If not specified , The default is /var/lib/nfs/statd.
sm-notify After startup ,sm-notify Will try to use UID/GID Set the owner and group of the directory . -v ipaddr | hostname
Specifies the source network address to use when sending system restart notifications , And send SM_NOTIFY On request mon_name The value of the parameter . If this option is not specified , be sm-
notify The generic address will be used as the source address , And use my_name Send as SM_NOTIFY On request mon_name. If this option is specified , be sm-
notify Convert IPV4 The address is the host name , Send as SM_NOTIFY On request mon_name.
This option is more suitable for hosts with multiple NIC interfaces , Especially when the remote peer needs to receive the notification from the specified address . ADDITIONAL NOTES
Lock recovery after host restart is very important to maintain data consistency and prevent unnecessary application hang . In order to let
rpc.statd Match more efficiently SM_NOTIFY request , Some best practices should be followed , include ： Systematic UTS Name requires and NFS The opposite end is used for connection DNS Names match .
( notes ： If you don't know what to do UTS name , It can be simply said that UTS The name is the host name ) Systematic UTS The name should always be fqdn The name of the format .
Systematic UTS Forward and reverse of names DNS It is best to keep the mapping consistent . The host name of the server used by the client to mount should match the one it sends SM_NOTIFY On request mon_name.
uninstall NFS The file system does not need to stop the status monitoring of either the client or the server . Both ends may continue to monitor for a period of time
time , In case there are new mounts and additional file locks between the two ends NFS Flow appears .
stay Linux upper , If not installed in the kernel lock module , All remote NFS The opposite end will not be monitored . This could happen in NFS Of
On the client , for example , Auto mount tool removed all NFS Mount point , Because they are idle and inactive . IPv6 and TI-RPC support TI-RPC is a
pre-requisitefor supporting NFS on IPv6. If TI-RPC support is built into
rpc.statd, it attempts to start listeners on network transports marked'visible'
in /etc/netconfig. As long as at least one network transport listener starts
successfully, rpc.statd will operate. FILES/var/lib/nfs/statd/sm directory
containing monitor list/var/lib/nfs/statd/sm.bak directory containing notify
list/var/lib/nfs/statd/state NSM state number for this host /proc/sys/fs/nfs/
nsm_local_state kernel's copy of the NSM state number SEE ALSO rpc.statd(8),
nfs(5), uname(2), hostname(7) RFC 1094 - "NFS: Network File System Protocol
Specification" RFC 1813 - "NFS Version 3 Protocol Specification" OpenGroup
Protocolsfor Interworking: XNFS, Version 3W - Chapter 11 AUTHORS Olaf Kirch
<[email protected]> Chuck Lever <[email protected]> 1 November 2009 SM-NOTIFY(8)
Here are NFS Related translation ：
translate ：man rpcbind(rpcbind Chinese handbook ) <http://www.cnblogs.com/f-ck-need-u/p/7302577.html>
translate ：man nfsd(rpc.nfsd Chinese handbook ) <http://www.cnblogs.com/f-ck-need-u/p/7302580.html>
translate ：man mountd(rpc.mountd Chinese handbook )
translate ：man statd(rpc.statd Chinese handbook ) <http://www.cnblogs.com/f-ck-need-u/p/7302593.html>
translate ：man sm-notify(sm-notify Chinese command manual )
translate ：man exportfs(exportfs Chinese command manual )
Partial translation ：man nfs <http://www.cnblogs.com/f-ck-need-u/p/7305755.html#blogmannfs>