Ubuntu NFS build process

https://www.cnblogs.com/wangn/p/3503701.html

Brief introduction

  NFS: is Network FileSystem. Biggest role is through the network, so that different machines, different operating systems, you can share files.
Attached to local, you can operate as a local directory to operate as a shared directory by the shared directory.
Divided in a shared server and client, it is necessary to install the program is not the same, by the client RPC server way to request the corresponding operation is completed.
Imagine become windows shared directory (permissions are set in the server's / etc / exports in).

          (1, NFS schematic)

  

          (2, RPC position on NFS)

Server


  安装nfs-server:
  sudo apt-get install nfs-kernel-server

Configuration

A profile is generally in the / etc / exports
added:
/ Hadoop * (RW, Sync, to no_subtree_check)
/ Home / Grid * (RW, Sync, to no_subtree_check)
of course also be used to specify a server name (hostname) or IP instead of *
configuration You need to restart nfs-server
restart command:
sudo restart /etc/init.d/nfs-kernel-server
Service nfs-Kernel-Server restart

     export options Description:

ro  The host has read-only access to the shared directory

rw  The host has read and write permissions to the shared directory

root_squash  client with root when users access the shared folder, the root user mapped to anonymous users

no_root_squash  clients use root to access the shared folder does not map root user

all_squash  any user on the client are mapped to the shared directory to access anonymous user anonuid  user on a client mapped to the local user specified ID of the user

anongid  user on the client mapped to the local user is in the specified group ID

sync  data synchronization is written to memory and hard drive

async  data will first be temporarily stored in memory, rather than directly written to the hard disk insecure  allow this machine over unauthorized access


Client

(1) Client-install nfs:
sudo install nfs-APT-GET the Common
(2) View shared directory on nfs server
showmount -e server IP
(3) create a shared mount points, mount and execute
sudo mkdir / home / grid / nfshadoop
sudo Mount ServerIP -t nfs: / hadoop / Home / Grid / nfshadoop
(4) modify / etc / fstab file, the system can automatically mount at startup nfs server directory
serverip: / hadoop / home / grid / nfshadoop nfs defaults 0 0
if you can see (5) new directory on the remote server to see
touch tmp


Further reading

    Source: http: //linux.vbird.org/linux_server/0330nfs.php#ps1

Bird Brother private kitchens: http: //linux.vbird.org/linux_server/0330nfs.php#ps1

http://f.dataguru.cn/forum.php?mod=viewthread&tid=156968
http://blog.csdn.net/ustc_dylan/article/details/8164080
http://tech.seety.org/debian/NFSConf.html#id8
http://www.92csz.com/study/linux/19.htm
https://help.ubuntu.com/lts/serverguide/network-file-system.html

Brief introduction

  NFS: is Network FileSystem. Biggest role is through the network, so that different machines, different operating systems, you can share files.
Attached to local, you can operate as a local directory to operate as a shared directory by the shared directory.
Divided in a shared server and client, it is necessary to install the program is not the same, by the client RPC server way to request the corresponding operation is completed.
Imagine become windows shared directory (permissions are set in the server's / etc / exports in).

          (1, NFS schematic)

  

          (2, RPC position on NFS)

Server


  安装nfs-server:
  sudo apt-get install nfs-kernel-server

Configuration

配置文件一般是在/etc/exports
添加:
/hadoop *(rw,sync,no_subtree_check)
/home/grid *(rw,sync,no_subtree_check)
当然也可以用指定的服务器名称(hostname)或IP代替*
配置完成需要重启nfs-server
重启命令:
sudo /etc/init.d/nfs-kernel-server restart
service nfs-kernel-server restart

     export选项说明:

ro 该主机对该共享目录有只读权限

rw 该主机对该共享目录有读写权限

root_squash 客户机用root用户访问该共享文件夹时,将root用户映射成匿名用户

no_root_squash 客户机用root访问该共享文件夹时,不映射root用户

all_squash 客户机上的任何用户访问该共享目录时都映射成匿名用户anonuid 将客户机上的用户映射成指定的本地用户ID的用户

anongid 将客户机上的用户映射成属于指定的本地用户组ID

sync 资料同步写入到内存与硬盘中

async 资料会先暂存于内存中,而非直接写入硬盘insecure 允许从这台机器过来的非授权访问


客户端

(1)安装nfs-client:
sudo apt-get install nfs-common
(2)查看nfs server 上共享的目录
showmount -e 服务器IP
(3)创建共享挂载点,并执行挂载
sudo mkdir /home/grid/nfshadoop
sudo mount -t nfs serverip:/hadoop /home/grid/nfshadoop
(4)修改/etc/fstab文件,让系统在启动时可以自动挂载nfs server目录
serverip:/hadoop /home/grid/nfshadoop nfs defaults 0 0
(5)新建目录看看远程服务器上是否可以看到
touch tmp


进阶阅读

    图片来源:http://linux.vbird.org/linux_server/0330nfs.php#ps1

鸟哥的私房菜:http://linux.vbird.org/linux_server/0330nfs.php#ps1

http://f.dataguru.cn/forum.php?mod=viewthread&tid=156968
http://blog.csdn.net/ustc_dylan/article/details/8164080
http://tech.seety.org/debian/NFSConf.html#id8
http://www.92csz.com/study/linux/19.htm
https://help.ubuntu.com/lts/serverguide/network-file-system.html

Guess you like

Origin www.cnblogs.com/idyllcheung/p/11423270.html