Home  >  Article  >  Operation and Maintenance  >  What is the function of linux rpc.statd

What is the function of linux rpc.statd

PHPz
PHPzforward
2023-06-01 20:37:371815browse

In Linux, rpc.statd is a process that implements the Network Status Monitoring (NSM) RPC protocol and notifies the NFS client when an NFS server restarts abnormally. The syntax is " /sbin/rpc.statd [-F] [-d] [-?] [-n name ] [-o port ] [-p port ] [-V]". The nfslock service will automatically start the rpc.statd process and does not require user configuration.

The following RPC background process provides services for NFS

  • rpc.mountd: This process accepts loads from NFS clients Request and verify that the requested file system is being exported. This process is automatically started by the NFS service and does not require user configuration.

  • rpc.nfsd: This process is the NFS server. It works with the Linux core to meet the dynamic needs of NFS clients, such as providing Server thread for each request. This process corresponds to the nfs service.

  • rpc.lockd: An optional process that allows NFS clients to lock files on the server. This process corresponds to the nfslock service.

  • rpc.statd: This process implements the Network Status Monitoring (NSM) RPC protocol to notify NFS clients when an NFS server restarts abnormally. This process is automatically started by the nfslock service. No user configuration is required.

  • rpc.rquotad: This process provides user quota information for remote users. This process is automatically started by the nfs service and does not require user configuration.

Linux Commands rpc.statd

The rpc.statd service implements the NSM (Network Status Monitor) RPC protocol.

This service is somewhat misnamed, as it does not actually provide proactive monitoring as one might suspect; instead, NSM implements a restart notification service.

rpc.lockd is a file service used to recover locked files when the NFS server crashes and restarts.

Using rpc.statd

In the past, on some Linux distributions, we needed to start rpc.statd separately when starting the NFS server.

This is mainly due to the old Sysvinit system.

Now we will find that starting NFS will automatically start rpc.statd and any other components required for the server to function properly.

systemctl start nfs

Or (depending on the distro)

systemctl start nfs-server

This is also true when enabling the server on startup.

Debian-based distributions such as Ubuntu and Linux Mint will enable NFS as soon as we install it, so there is no need to do this, but enabling the server will look like this:

systemctl enable nfs

or

systemctl enable nfs-server

Again, the exact command depends on the distribution.

"nfs-server" is a Debian-based system.

  • If we need to customize the behavior of rpc.statd, we can do so using the following options.

  • Normally, we would not want to run this command alone.

  • Instead, we will make a copy of the Systemd service file, creating a backup of the original and a new copy to modify freely.

  • We will then use the following options to change how the service is called from that service file.

Syntax

/sbin/rpc.statd [-F] [-d] [-?] [-n name ] [-o port ] [-p port ] [-V]

Operation

For each NFS client or server to be monitored machine, rpc.statd creates a file in /var/lib/nfs/statd/sm.

When started, it iterates through these files and notifies peerrpc.statd on these machines.

Options

-F

By default, rpc.statd is forked and placed in the background on startup. The

-F parameter tells it to stay in the foreground.

This option is mainly used for debugging purposes.

-d

By default, rpc.statd sends log messages to the system log via syslog(3). The

-d parameter forces it to log verbose output to stderr instead.

This option is mainly used for debugging purposes and can only be used in conjunction with the -F parameter.

-n, --name name

Specify a name for rpc.statd to use as the local host name.

By default, rpc.statd will call gethostname(2) to obtain the local host name.

Specifying the local hostname may be useful for machines with multiple interfaces.

-o, --outgoing-port port

Specify a port for rpc.statd to send outgoing status requests from.

By default, rpc.statd will ask portmap (8) to assign it a port number.

As of this writing, there is no standard port number that portmap always or usually assigns.

Specifying ports may be useful when implementing a firewall.

-p, --port port

Specify the port that rpc.statd listens on.

By default, rpc.statd will ask portmap (8) to assign it a port number.

As of this writing, there is no standard port number that portmap always or usually assigns.

Specifying ports may be useful when implementing a firewall.

-?

Causes rpc.statd to print out command line help and exit.

-V

Cause rpc.statd to print out version information and exit.

TCP_WRAPPERS SUPPORT

This version of rpc.statd is protected by the tcp_wrapper library.

如果允许客户端使用 rpc.statd,则必须授予客户端访问权限。

要允许来自 .bar.com 域的客户端的连接,我们可以在 /etc/hosts.allow 中使用以下行:

statd: .bar.com

我们必须使用守护程序名称 statd 作为守护程序名称(即使二进制文件具有不同的名称)。

The above is the detailed content of What is the function of linux rpc.statd. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete