linux 搭建NFS

首先我們將134資源通過NFS映射到135機器上

首先 134環境準備

  1. 安裝nfs服務 使用命令 yum install -y nfs-utils
  2. 修改nfs配置在vim /etc/sysconfig/nfs裏面修改

    LOCKD_TCPPORT=50001    # TCP鎖使用端口
    LOCKD_UDPPORT=50002    # UDP鎖使用端口
    MOUNTD_PORT=50003      # 掛載使用端口

STATD_PORT=50004 # 狀態使用端口
RDMA_PORT=50005

#配置映射及權限

#/data,本地文件路徑
#10.10.10.135,允許掛載的IP,可以通過子網掩碼進行網段批量設置
#(ro, sync, all_squash),ro只讀權限,sync同步(文件同步寫入到內存和磁盤當中),all_squash(限定權限)

vim /etc/exports
/data 10.10.10.135(ro,sync,all_squash)

#啓動nfs服務

service nfs start
chkconfig nfs on

service rpcbind start
chkconfig rpcbind on

如果本地開放防火牆,需要配置爲靜態端口,並且通過iptable開放相關端口。


二、135環境(root@135)
#安裝nfs
yum install nfs-utils

#掛載134資源
#將nfs 10.10.10.134 的/data目錄映射到本地/data目錄(需要提前建立本地/data目錄)
mount -t nfs 10.10.10.134:/data /data

#NGINX設置(具體配置根據路徑設定,通過error.log,可以很容易調試並設定成功)
vim nginx.conf
location /feed/data/fullfeed
{
root /;
autoindex on; # for test
autoindex_exact_size on; # for test
autoindex_localtime on; # for test
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章