Shared storage NFS

Source: Internet
Author: User
Tags nfsd

NFS (Network file system), a network file system, is one of the file systems supported by FreeBSD that allows computers in the network to share resources across TCP/IP networks. In an NFS application, a local NFS client application can transparently read and write to files located on the remote NFS server, just as you would access a local file. First, the basic Environment 1) server 10.1.10.117 erh0 7.8 (Debian)  3.2.0-4-amd642) client 10.1.10.160 eth0 5.0.10 ( Debian)  2.6.26-2-amd64 Second, install NFS1, install NFS server Apt-get -y install nfs-kernel-server2, create a shared directory mkdir  /OPT/NFSDATA -P3, modifying configuration cat /etc/exports/opt/nfsdata 10.1.10.117 (Rw,async,no_root_squash)  10.1.10.160 (Rw,async,no_root_squash) 4, parameter description ro                  #只读访问rw                   #读写访问sync                #将数据同步写入内存缓冲区与磁盘中, low efficiency, but can guarantee the consistency of data async               #将数据先保存在内存缓冲区中, write disk secure         & if necessarynbsp;   #限制客户端只能从小于1024的tcp/IP Port connection to server for NFS insecure            #允许客户端从大于1024的tcp/IP Port connection Server wdelay              #检查是否有相关的写操作, if any, perform these writes together, which can improve efficiency no_wdelay           #若有写操作则立即执行 should be used in conjunction with Sync hide                #在NFS共享目录中不共享其子目录no_hide            # The subdirectory for the shared NFS directory subtree_check      #若输出目录是一个子目录, and the NFS server checks the permissions of its parent directory no_subtree_check    #即使输出目录是一个子目录, Server for NFS does not check the permissions of its parent directory, which can improve efficiency all_squash        # Maps all normal users and groups that are accessed remotely to anonymous users or user groups (Nfsnobody) no_all_squash      #与all_squash取反root_squash         #将root用户及所属组都映射为匿名用户或用户组no_root_squash     # Anti-anonuid=xxx     & with Rootsquashnbsp;  #将远程访问的所有用户都映射为匿名用户 and specifies that the user is a local user (uid=xxx) anongid=xxx       # Map all remote access user groups to the anonymous user group account and specify that the anonymous user group account is a local user group account (GID=XXX) 5, restart the service [ ok ] stopping nfs kernel  DAEMON: MOUNTD NFSD. [ ok ] unexporting directories for nfs kernel daemon .... [....]  Exporting directories for NFS kernel daemon...exportfs: /etc/exports  [1]: neither  ' Subtree_check '  or  ' No_subtree_check '  specified for export   "10.1.10.117:/opt/nfsdata" .  assuming default behaviour  (' No_subtree_check ').   NOTE: this default has changed since nfs-utils version  1.0.xexportfs: /etc/exports [1]: neither  ' Subtree_check '  or  ' No_subtree_check '  specified for export  "10.1.10.160:/opt/nfsdata".   assuming default behaviour  (' No_subtree_check ').   note: this default has changed since  nfs-utils version 1.0.x. ok [ ok ] starting nfs kernel  daemon: nfsd mountd.6, view share specific information cat /var/lib/nfs/etab/opt/nfsdata     10.1.10.117 (Rw,async,wdelay,hide,nocrossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks, acl,anonuid=65534,anongid=65534)/opt/nfsdata    10.1.10.160 (Rw,async,wdelay,hide, nocrossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534) 7 , use the Showmount command to view the shared directory showmount -eexport list for debian:/opt/nfsdata  10.1.10.160,10.1.10.1178, use the rpcinfo command to view the monitored ports rpcinfo -p 10.1.10.117   program vers  proto   port  service    100000    4    tcp    111  portmapper    100000    3   tcp     111  portmapper    100000    2    Tcp    111  portmapper    100000    4    udp    111  portmapper    100000     3   udp    111  portmapper     100000    2   udp    111  portmapper     100024    1   udp  56564   status    100024    1   tcp  46588   status    100003    2   tcp   2049   nfs    100003    3   tcp   2049  nfs     100003    4   tcp   2049  nfs     100227    2   tcp   2049     100227    3   tcp   2049    100003     2   udp   2049  nfs     100003    3   udp   2049  nfs     100003    4   udp   2049  nfs     100227    2   udp   2049     100227    3   udp   2049    100021     1 &Nbsp; udp  41855  nlockmgr    100021    3    udp  41855  nlockmgr    100021     4   udp  41855  nlockmgr    100021     1   tcp  38046  nlockmgr    100021     3   tcp  38046  nlockmgr    100021     4   tcp  38046  nlockmgr     100005    1   udp  36619  mountd     100005    1   tcp  37282  mountd     100005    2   udp  54466  mountd     100005    2   tcp  57293  mountd    100005     3   udp  52004  mountd    100005     3   TCP  40933  MOUNTD9, view to the corresponding service is on by default boot up (automatically added when installing) ll /etc /rc2.d/lrwxrwxrwx 1 root root  17 aug  4 14:52 s13rpcbind  ->&NBSP, .... /init.d/rpcbindlrwxrwxrwx 1 root root  20 aug  4 14:52  S14NFS-COMMON ->&NBSP, .... /init.d/nfs-commonlrwxrwxrwx 1 root root  27 aug  4 14:52  S16NFS-KERNEL-SERVER ->&NBSP, .... /INIT.D/NFS-KERNEL-SERVER        10, test 1) native Mount Mount -t nfs  10.1.10.117:/opt/nfsdata/ /mnt2) View df -thfilesystem                                               type      size   Used Avail Use% Mounted onrootfs                                                    rootfs    9.2G  703M  8.1G    8% /udev                                                      devtmpfs   10M     0   10M   0% /devtmpfs                                                     tmpfs       24m  236k   23m   1% /run/dev/disk/by-uuid/ 62f9f2a1-249c-41fe-b639-c5137c10bf83 ext4      9.2g  703m   8.1G   8% /tmpfs                                                     tmpfs     5.0m     0  5.0m   0% /run/locktmpfs                                                     tmpfs      810M     0  810M   0% /run/shm/dev/sda5                                                 ext4       27G   172M   26G   1% /opt10.1.10.117:/opt/nfsdata                                 nfs4       27g  172m   26g    1% /MNT Three, client mount (remote) 10.1.10.1601, install NFS client Apt-get -y install nfs-common2, View 10.1.10.117 shared directory information Showmount -e 10.1.10.117export list for 10.1.10.117:/opt/nfsdata  10.1.10.160,10.1.10.1173, re-mount Mount -t nfs 10.1.10.117:/opt/nfsdata/ /mnt4, view [email  protected]:~# df -ThFilesystem    Type    Size   Used Avail Use% Mounted on/dev/sda1     ext3     9.2G  801M  8.0G   9% /tmpfs         tmpfs    124M     0  124M    0% /lib/init/rwudev         tmpfs     10m   700k  9.4m   7% /devtmpfs        tmpfs     124m     0  124m   0% /dev/shm/ dev/sda5     ext3     17g  487m    16g   3% /opt10.1.10.117:/opt/nfsdata/                nfs     27G  172M    26G   1% /MNT5, add/etc/fstab Boot auto mount 1) Add 10.1.10.117:/opt/nfsdata /in/etc/fstab last 1 lines MNT NFS DEFAULTS 0 02) Use mount -a check [email protected]:~# df - Thfilesystem    type    size  used avail use%  mounted on/dev/sda1     ext3    9.2g  802m  8.0g   9%  /tmpfs        tmpfs    124M      0  124M   0% /lib/init/rwudev          tmpfs     10M  700K  9.4M    7% /devtmpfs        tmpfs    124M      0  124M   0% /dev/shm/dev/sda5      ext3     17g  487m   16g   3% / opt10.1.10.117:/opt/nfsdata                nfs     27g  172m   26g   1%  /mnt                Four, Server View 1, on the server can see the client 10.1.10.160 has been connected up showmount  -aall mount points on debian:10.1.10.160:/opt/nfsdata2, can see 10.1.10.160 mounted scraping information cat  /VAR/LIB/NFS/RMTAB 10.1.10.160:/OPT/NFSDATA:0X00000001 Five, there are exportfs nfsstat and other orders, temporarily useless, you can experience the next six, Reference article http://nfs.sourceforge.net/

This article is from the "7928217" blog, please be sure to keep this source http://7938217.blog.51cto.com/7928217/1681697

Shared storage NFS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.