rpc.statd
是 Linux 系统中 NFS(Network File System) 相关服务的一部分,属于 NSM(Network Status Monitor) 守护进程。它的主要作用是监控 NFS 服务器和客户端之间的连接状态,并在主机重启或网络中断后协助恢复 NFS 文件锁(文件锁管理由 rpc.lockd
负责)。
崩溃恢复(Crash Recovery)
rpc.statd
会通知对方主机,确保文件锁状态的一致性。rpc.lockd
协同工作,防止因网络中断或主机崩溃导致文件锁永久挂起。状态监控(Status Monitoring)
rpc.statd
通信,交换主机状态信息(如“正常运行”或“重启”)。bash
systemctl status rpc-statd # 使用 systemd 的系统
service nfs-common status # 部分旧系统可能使用此命令
bash
systemctl start rpc-statd # 启动
systemctl stop rpc-statd # 停止
rpc.statd
默认通过 RPC 端口(动态分配) 通信,依赖 rpcbind
服务。rpc.statd
和 rpc.lockd
均正常运行。bash
systemctl disable rpc-statd
防火墙配置
rpc.statd
使用的端口(通常通过 rpcinfo -p
查看)在防火墙中开放。日志排查
/var/log/messages
或 journalctl -u rpc-statd
。rpc.statd
无法连接到远程主机的 rpcbind
。Q: rpc.statd
占用高 CPU 或内存?
A: 可能是频繁的网络状态检查或 NFS 锁冲突,需检查 NFS 连接稳定性。
Q: 如何确认 rpc.statd
正在运行?
A: 运行 rpcinfo -p
或 ps aux | grep statd
,查看是否有相关进程。
rpc.statd
是 NFS 文件锁管理的核心组件之一,确保分布式环境下的文件锁一致性。在 NFS 服务器/客户端部署中通常无需手动配置,但若遇到锁问题或性能异常时,需检查此服务状态。