五、然后重启如下服务:
service rpcbind start
service nfs restart
最后发现挂载nfs存储成功。
注意:RPC必须先启动。RPC即Remote Procedure Call Protocol(远程过程调用协议),RPCBIND用于取代旧版本中的portmap组件。 简单说,RPCBIND就是为了将不同服务与对应的端口进行绑定,以便支持机器间的互操作。原理补充:RPC 最主要的功能就是指定每个 NFS 功能所对应的 port number ,並且回报給用戶端,让用戶端可以連結到正確的端口上去。 当服务器在启动 NFS 時会随机取用数个端口,并主动的向 RPC 注册,因此 RPC 可以知道每个端口对应的 NFS 功能,然后 RPC 通过固定使用 port 111 來监听用户端的请求并回报用户端正确的端口,来确保NFS连接的成功!
另外关于FSID参数的解释:
要通过NFS共享一个目录,首先需要在/etc/exports文件中定义这个目录,并且使用fsid=0的参数。(使用fsid=0选项的时候只能共享一个目录,这个目录将成为NFS服务器的根目录。)
参看如下英文原版解释:
fsid=num
This option forces the filesystem identification portion of the file handle and file attributes used on the
wire to be num instead of a number derived from the major and minor number of the block device on which the
filesystem is mounted. Any 32 bit number can be used, but it must be unique amongst all the exported
filesystems.
This can be useful for NFS failover, to ensure that both servers of the failover pair use the same NFS file
handles for the shared filesystem thus avoiding stale file handles after failover.
Some Linux filesystems are not mounted on a block device; exporting these via NFS requires the use of the
fsid option (although that may still not be enough).
The value 0 has a special meaning when use with NFSv4. NFSv4 has a concept of a root of the overall
exported filesystem. The export point exported with fsid=0 will be used as this root.