linux 使用NSF 映射远程磁盘目录

假设源目录在192.168.1.1机器上,目录为/data

客户端集群在192.168.1.2, 需要将192.168.1.1机器上的/data目录到本地的/data目录

 

1、在两台机器上安装nsf 、 portmap

 

[sql] view plain copy
 
  1. yum  install  nfs-utils  portmap  

 

 

安装好了之后。

 

2、

在192.168.1.1机器上面修改/etc/exports文件,加入如下内容

 

[sql] view plain copy
 
  1. /data/ 192.168.1.2(rw,sync,no_root_squash)  

表示开放本机器上面/data目录, 主机192.168.1.2对该目录拥有rw权限。其他参数可以去查看nsf文档,这里不解释

 

然后启用nsf与portmap服务

 

 

[plain] view plain copy
 
  1. service rpcbind start  
  2. service nfs start   

 

3、

在192.168.1.2机器上面启动nsf与portmap服务然后挂载remote目录

 

[plain] view plain copy
 
  1. service rpcbind start  
  2. service nfs start   

 

 

[plain] view plain copy
 
  1. mount -t nfs 192.168.1.1:/data/  /data/  

 

 

将机器192.168.1.1上面的/data目录挂在到本机的/data目录下面

现在就可以在192.168.1.2机器上面对/data目录进行读改操作了。 

posted @ 2018-01-24 10:30  追忆丶年华  阅读(416)  评论(0编辑  收藏  举报