私は今、192.168.0.101と192.168.0.102の2台のマシンを持っています
192.168.0.101はサーバー、192.168.0.102はクライアント、/ home / allen / packages / shareは共有ディレクトリです。
次に、共有ディレクトリが確立されたら、クライアントの共有ディレクトリにファイルを作成し、そのファイルがサーバーに存在するかどうかを確認します。
クライアントとサーバーにそれぞれntfsとrpcbindをインストールします
1.ntfs-utilsをインストールします
yum -y install ntfs-utils
2.rpcbindをインストールします
yum install rpcbind
3.インストールステータスを確認します
[root@localhost share]# rpm -qa| grep nfs
libnfsidmap-0.25-19.el7.x86_64
nfs4-acl-tools-0.3.3-17.el7.x86_64
nfs-utils-1.3.0-0.68.el7.x86_64
[root@localhost share]# rpm -qa | grep rpcbind
rpcbind-0.2.0-49.el7.x86_64
[root@localhost share]#
4.サーバーとクライアントの両方に共有ディレクトリを作成します
mkdir / home / allen / packages / share
サーバー上の2つの構成共有ファイル
1.サーバー側で共有情報を構成します
vi / etc / exports
/home/allen/packages/share 192.168.0.102(rw,sync,no_root_squash)
最初の部分は、共有ディレクトリ/ home / allen / packages / shareです。
2番目の部分は、クライアントのIPアドレス192.168.0.102です。
3番目の部分は、共有ディレクトリのアクセス許可です
2.上記の構成ファイルをすぐに有効にします
exportfs -r
3つは、クライアントとサーバーでそれぞれ次のサービスを開始します
1.サービスを開始します
systemctl start rpcbind
systemctl start nfs
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs
2.起動ステータスを表示します
[root@localhost ~]# systemctl status nfs
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
Active: active (exited) since Sun 2021-01-17 05:50:23 PST; 2s ago
Process: 2457 ExecStartPost=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS)
Process: 2441 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Process: 2440 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Main PID: 2441 (code=exited, status=0/SUCCESS)
Tasks: 0
CGroup: /system.slice/nfs-server.service
Jan 17 05:50:23 localhost.localdomain systemd[1]: Starting NFS server and services...
Jan 17 05:50:23 localhost.localdomain systemd[1]: Started NFS server and services.
[allen@localhost ~]$ systemctl status rpcbind
● rpcbind.service - RPC bind service
Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2021-01-17 05:48:52 PST; 21min ago
Process: 546 ExecStart=/sbin/rpcbind -w $RPCBIND_ARGS (code=exited, status=0/SUCCESS)
Main PID: 554 (rpcbind)
Tasks: 1
CGroup: /system.slice/rpcbind.service
└─554 /sbin/rpcbind -w
クライアントでの4つのハング操作
1.クライアントテストがハングするディレクトリ
[root@localhost share]# showmount -e 192.168.0.101
Export list for 192.168.0.101:
/home/allen/packages/share 192.168.0.102
2.クライアントマウント
[root@localhost share]# mount -t nfs 192.168.0.101:/home/allen/packages/share /home/allen/packages/share
[root@localhost share]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
この状況では5つのテストがハングします
1.クライアントで新しいファイルを作成します
[root@localhost share]# vi hellowork.txt
[root@localhost share]#
2.サービス中の表示
[root@localhost ~]# cd /home/allen/packages/share
[root@localhost share]# ls
hellowork.txt