RPC: program not registered (ZT)

When we trying to use a particular RPC  program, below may indicate that rpcbind is not running or the program is not registered with rpcbind.

Error “RPC: Program not registered”

When an RPC service is started, it makes a library call that tells rpcbind the address at which it is listening and the RPC version numbers it is prepared to serve.

When a client wishes to make an RPC call to a given program number, it first contacts rpcbind on the server machine to determine the address to which requests should be sent. Therefore, if rpcbind is not running, RPC processes would not be registered on the server.

To check whether rpcbind is running:

On Server :

$ ps -e | grep rpcbind

139 ?        0:00 rpcbind

$ pgrep -l rpcbind

139 rpcbind

From a client: (and the server could also be client)

use rpcinfo The rpcinfo(1M) command lists RPC services available. If there are plenty of services listed, it is possible that the particular service required is no longer registered.  If there are no services registered then it is most likely that rpcbind has been restarted and all previous RPC bindings have been lost.

$ rpcinfo -s servername

Also, rpcbind should be started before any RPC service.  If a RPC daemon is started before rpcbind, the daemon will run but will not be registered and will therefore not be accessible. To check whether a particular service is running a call can be made to the specific service. Just because a service is registered doesn’t mean it is responding. The rpcinfo(1M) command can make an explicit call to a specific service.

$ rpcinfo -T tcp servername nfs

program 100003 version 2 ready and waiting
program 100003 version 3 ready and waiting

If an RPC based daemon is not registered but is running (verified with the ‘ps’ command) then restarting the daemon should cause it to register.

Not all RPC based daemons can easily or safely be restarted and in many cases it is simpler to reboot. Do not attempt to restart rpcbind using /etc/init.d/rpc. The “stop“ script kills the rpcbind process which will lose all existing bindings.  The “start” script starts rpcbind with no bindings at all.

The “start” and “stop” functions of /etc/init.d/rpc are only intended for system start-up and shutdown. If rpcbind has been stopped and restarted without the use of the “warm start” feature then the safest recovery procedure is to reboot.

A partial recovery can be made by restarting any RPC daemons and sending a HUP signal to inetd to reregister RPC services it manages.  This is not recommended and a clean reboot is always the preferred method of recovery.

原文地址:https://www.cnblogs.com/cqubityj/p/3248157.html