NFSのインストール

2482 ワード

設定
$ yum install nfs-utils
$ yum install net-tools
$ systemctl --now enable nfs-server.service

ホストサーバ


vi/etc/exports
/data/crm              218.232.94.67(rw,no_root_squash,sync)
/data/crm              218.232.94.157(rw,no_root_squash,sync)
/data/storage          192.168.94.41(rw,no_root_squash,sync)
/data/crm              192.168.94.41(rw,no_root_squash,sync)
/data/storage          192.168.94.42(rw,no_root_squash,sync)
/data/crm              192.168.94.42(rw,no_root_squash,sync)
/data/storage          192.168.94.43(rw,no_root_squash,sync)
/data/crm              192.168.94.43(rw,no_root_squash,sync)
/data/storage          192.168.94.44(rw,no_root_squash,sync)
/data/crm              192.168.94.44(rw,no_root_squash,sync)



/root/nfs_test/15          192.168.1.15(rw,no_root_squash,sync)




$ mkdir/root/nfs_test/15

マルチサーバ


$ mkdir -p/data/storage
$ touch/data/storage/hello.txt
$ df -h
$ vi/etc/fstab
192.168.1.203:/root/nfs_test/15 /data/storage   nfs     hard            0 0
$ mount -t nfs 192.168.1.203:/root/nfs_test/15/data/storage
$ mount -a

サービスホームサーバ設定値


サーバ(218.232.94160)


vi/etc/exports
/data/crm 218.232.94.66(rw,no_root_squash,sync)
/data/crm 218.232.94.67(rw,no_root_squash,sync)
/data/crm 218.232.94.157(rw,no_root_squash,sync)
/data/storage 192.168.94.41(rw,no_root_squash,sync)
/data/crm 192.168.94.41(rw,no_root_squash,sync)
/data/storage 192.168.94.42(rw,no_root_squash,sync)
/data/crm 192.168.94.42(rw,no_root_squash,sync)
/data/storage 192.168.94.43(rw,no_root_squash,sync)
/data/crm 192.168.94.43(rw,no_root_squash,sync)
/data/storage 192.168.94.44(rw,no_root_squash,sync)
/data/crm 192.168.94.44(rw,no_root_squash,sync)

クライアント(218.232.994.72.73.74)


$ vi/etc/fstab
192.168.94.160:/data/storage/barosvc    /storage/barosvc        nfs     hard            0 0
192.168.94.160:/data/crm                /storage/crm            nfs     hard            0 0

クライアント(218.232.94.75)


$ vi/etc/fstab
192.168.94.160:/data/crm                /storage/crm            nfs     hard            0 0