NFS网络文件共享服务

NFS-网络文件系统,它的主要功能是通过网络让不同的主机系统之间可以彼此共享文件或目录。

NFS在企业中得应用场景

在企业集群架构的工作场景中,NFS网络文件系统一般被用来存储共享视频、图片、附件等静态资源文件(一般把网站用户上传的文件都放到NFS共享里,例如:BBS产品的图片、附件、头像,注意网站BBS程序不要放NFS共享里),NFS是当前互联网系统架构中最常用的数据存储服务之一,特别是中小型网站公司应用频率很高。大公司或门户除了使用NFS外,还可能会使用MFS、GFS、FASTFS,TFS等分布式文件系统。

--------------------------------------分割线 --------------------------------------

Ubuntu 12.04安装NFS server

NFS服务器安装配置实现Ubuntu 12.04与ARM文件共享

Ubuntu搭建nfs服务器

文件服务器NFS配置详解

Ubuntu下搭建NFS网络文件系统服务器

Heartbeat_ldirector+LB+NFS实现HA及LB、文件共享

CentOS 5.5配置NFS服务器教程

Ubuntu 12.10下NFS的安装使用

--------------------------------------分割线 --------------------------------------

[root@LAMP ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3            7.6G  2.0G  5.2G  28% /
tmpfs                495M    0  495M  0% /dev/shm
/dev/sda1            190M  27M  153M  15% /boot
192.168.0.113:/data/cms
7.6G  4.2G  3.1G  59% /data/cms/uploads/allimg
192.168.0.113:/data/blog
7.6G  4.2G  3.1G  59% /data/blog/wp-content/uploads
192.168.0.113:/data/bbs
7.6G  4.2G  3.1G  59% /data/bbs/data/attachment/forum
提示:mount 源 目标
mount 192.168.0.113:/data/bbs(远端NFS server IP地址及共享目录) /data/bbs/data/attachment/forum(本地目录)
Centos5.X随机端口为小于1024的,而Centos6.X随机端口都是较大的.
RPC-远程过程调用服务,最主要的功能就是记录每个NFS功能所对应的端口号,并且在NFS客户端请求时将该端口和功能对应的信息传递给请求数据的NFS客户端,从而可以确保客户端可以连接到正确的NFS端口上去,达到实现数据传输交互数据的目的.
一、NFS工作原理
1.先开启RPC服务(C5:portmap,C6:rpcbind)
2.向RPC服务注册启动的端口
3.客户端请求NFS服务
4.返回端口给客户端
5.拿着地址端口请求传输数据
二、NFS实战
NFS服务端:
[root@backup ~]# cat /etc/RedHat-release
CentOS release 6.6 (Final)
[root@backup ~]# uname -r Centos当前系统内核版本号
2.6.32-504.el6.x86_64
[root@backup ~]# uname -m
x86_64
[root@backup ~]# uname -n 机器名
backup
[root@backup ~]# rpm -qa "nfs-utils|rpcbind|portmap"
[root@backup ~]# yum grouplist
Loaded plugins: fastestmirror, security
Setting up Group Process
Determining fastest mirrors
* base: mirrors.sina.cn
* extras: mirrors.sina.cn
* updates: mirrors.sina.cn
base                        | 3.7 kB    00:00
extras                      | 3.4 kB    00:00
extras/primary_db          |  31 kB    00:00
updates                    | 3.4 kB    00:00
updates/primary_db          | 3.9 MB    00:11
base/group_gz              | 216 kB    00:00
Installed Groups:
Base
Compatibility libraries
Development tools
E-mail server
Graphical Administration Tools
Hardware monitoring utilities
Legacy UNIX compatibility
Networking Tools
Performance Tools
Perl Support
Scientific support
Security Tools
System administration tools
Available Groups:
Additional Development
Backup Client
Backup Server
CIFS file server
Client management tools
Console internet tools
Debugging Tools
Desktop
Desktop Debugging and Performance Tools
Desktop Platform
Desktop Platform Development
Dial-up Networking Support
Directory Client
Directory Server
Eclipse
Emacs
FCoE Storage Client
FTP server
Fonts
General Purpose Desktop
Graphics Creation Tools
Guest Agents
High Availability
High Availability Management
Identity Management Server
Infiniband Support
Input Methods
Internet Applications
Internet Browser
Java Platform
KDE Desktop
Large Systems Performance
Legacy X Window System compatibility
Load Balancer
Mainframe Access
Messaging Client Support
MySQL Database client
MySQL Database server
NFS file server
Network Infrastructure Server
Network Storage Server
Network file system client
Office Suite and Productivity
PHP Support
PostgreSQL Database client
PostgreSQL Database server
Print Server
Printing client
Remote Desktop Clients
Resilient Storage
Ruby Support
SNMP Support
Scalable Filesystems
Server Platform
Server Platform Development
Smart card support
Storage Availability Tools
System Management
TeX support
Technical Writing
TurboGears application framework
Virtualization
Virtualization Client
Virtualization Platform
Virtualization Tools
Web Server
Web Servlet Engine
Web-Based Enterprise Management
X Window System
iSCSI Storage Client
Available Language Groups:
Afrikaans Support [af]
Albanian Support [sq]
Amazigh Support [ber]
Arabic Support [ar]
Armenian Support [hy]
Assamese Support [as]
Azerbaijani Support [az]
Basque Support [eu]
Belarusian Support [be]
Bengali Support [bn]
Bhutanese Support [dz]
Brazilian Portuguese Support [pt_BR]
Breton Support [br]
Bulgarian Support [bg]
Catalan Support [ca]
Chhattisgarhi Support [hne]
Chichewa Support [ny]
Chinese Support [zh]
Coptic Support [cop]
Croatian Support [hr]
Czech Support [cs]
Danish Support [da]
Dutch Support [nl]
English (UK) Support [en_GB]
Esperanto Support [eo]
Estonian Support [et]
Ethiopic Support [am]
Faroese Support [fo]
Fijian Support [fj]
Filipino Support [fil]
Finnish Support [fi]
French Support [fr]
Frisian Support [fy]
Friulian Support [fur]
Gaelic Support [gd]
Galician Support [gl]
Georgian Support [ka]
German Support [de]
Greek Support [el]
Gujarati Support [gu]
Hebrew Support [he]
Hiligaynon Support [hil]
Hindi Support [hi]
Hungarian Support [hu]
Icelandic Support [is]
Indonesian Support [id]
Interlingua Support [ia]
Inuktitut Support [iu]
Irish Support [ga]
Italian Support [it]
Japanese Support [ja]
Kannada Support [kn]
Kashmiri Support [ks]
Kashubian Support [csb]
Kazakh Support [kk]
Khmer Support [km]
Kinyarwanda Support [rw]
Konkani Support [kok]
Korean Support [ko]
Kurdish Support [ku]
Lao Support [lo]
Latin Support [la]
Latvian Support [lv]
Lithuanian Support [lt]
Low Saxon Support [nds]
Luxembourgish Support [lb]
Macedonian Support [mk]
Maithili Support [mai]
Malagasy Support [mg]
Malay Support [ms]
Malayalam Support [ml]
Maltese Support [mt]
Manx Support [gv]
Maori Support [mi]
Marathi Support [mr]
Mongolian Support [mn]
Myanmar (Burmese) Support [my]
Nepali Support [ne]
Northern Sotho Support [nso]
Norwegian Support [nb]
Occitan Support [oc]
Oriya Support [or]
Persian Support [fa]
Polish Support [pl]
Portuguese Support [pt]
Punjabi Support [pa]
Romanian Support [ro]
Russian Support [ru]
Sanskrit Support [sa]
Sardinian Support [sc]
Serbian Support [sr]
Sindhi Support [sd]
Sinhala Support [si]
Slovak Support [sk]
Slovenian Support [sl]
Somali Support [so]
Southern Ndebele Support [nr]
Southern Sotho Support [st]
Spanish Support [es]
Swahili Support [sw]
Swati Support [ss]
Swedish Support [sv]
Tagalog Support [tl]
Tajik Support [tg]
Tamil Support [ta]
Telugu Support [te]
Tetum Support [tet]
Thai Support [th]
Tibetan Support [bo]
Tsonga Support [ts]
Tswana Support [tn]
Turkish Support [tr]
Turkmen Support [tk]
Ukrainian Support [uk]
Upper Sorbian Support [hsb]
Urdu Support [ur]
Uzbek Support [uz]
Venda Support [ve]
Vietnamese Support [vi]
Walloon Support [wa]
Welsh Support [cy]
Xhosa Support [xh]
Zulu Support [zu]
Done
[root@backup ~]# yum groupinstall "NFS file server" -y  NFS服务端
Loaded plugins: fastestmirror, security
Setting up Group Process
Loading mirror speeds from cached hostfile
* base: mirrors.sina.cn
* extras: mirrors.sina.cn
* updates: mirrors.sina.cn
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.2.3-54.el6 will be installed
--> Processing Dependency: nfs-utils-lib >= 1.1.0-3 for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: keyutils >= 1.4-4 for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: rpcbind for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: libtirpc for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: libgssglue.so.1(libgssapi_CITI_2)(64bit) for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: libgssglue for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: libevent for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: libtirpc.so.1()(64bit) for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: libgssglue.so.1()(64bit) for package: 1:nfs-utils-1.2.3-54.el6.x86_64
--> Processing Dependency: libevent-1.4.so.2()(64bit) for package: 1:nfs-utils-1.2.3-54.el6.x86_64
---> Package nfs4-acl-tools.x86_64 0:0.3.3-6.el6 will be installed
--> Running transaction check
---> Package keyutils.x86_64 0:1.4-5.el6 will be installed
---> Package libevent.x86_64 0:1.4.13-4.el6 will be installed
---> Package libgssglue.x86_64 0:0.1-11.el6 will be installed
---> Package libtirpc.x86_64 0:0.2.1-10.el6 will be installed
---> Package nfs-utils-lib.x86_64 0:1.1.5-9.el6_6 will be installed
---> Package rpcbind.x86_64 0:0.2.0-11.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================
Package      Arch  Version        Repository
Size
===================================================
Installing:
nfs-utils    x86_64 1:1.2.3-54.el6 base    326 k
nfs4-acl-tools
x86_64 0.3.3-6.el6    base    43 k
Installing for dependencies:
keyutils      x86_64 1.4-5.el6      base    39 k
libevent      x86_64 1.4.13-4.el6  base    66 k
libgssglue    x86_64 0.1-11.el6    base    23 k
libtirpc      x86_64 0.2.1-10.el6  base    79 k
nfs-utils-lib x86_64 1.1.5-9.el6_6  updates  68 k
rpcbind      x86_64 0.2.0-11.el6  base    51 k
Transaction Summary
===================================================
Install      8 Package(s)
Total download size: 695 k
Installed size: 1.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): keyutils-1.4-5.el6.x |  39 kB    00:00
(2/8): libevent-1.4.13-4.el |  66 kB    00:00
(3/8): libgssglue-0.1-11.el |  23 kB    00:00
(4/8): libtirpc-0.2.1-10.el |  79 kB    00:00
(5/8): nfs-utils-1.2.3-54.e | 326 kB    00:00
(6/8): nfs-utils-lib-1.1.5- |  68 kB    00:00
(7/8): nfs4-acl-tools-0.3.3 |  43 kB    00:00
(8/8): rpcbind-0.2.0-11.el6 |  51 kB    00:00
---------------------------------------------------
Total              283 kB/s | 695 kB    00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libgssglue-0.1-11.el6.x86_64    1/8
Installing : libtirpc-0.2.1-10.el6.x86_64    2/8
Installing : rpcbind-0.2.0-11.el6.x86_64    3/8
Installing : keyutils-1.4-5.el6.x86_64      4/8
Installing : libevent-1.4.13-4.el6.x86_64    5/8
Installing : nfs-utils-lib-1.1.5-9.el6_6.x  6/8
Installing : 1:nfs-utils-1.2.3-54.el6.x86_  7/8
Installing : nfs4-acl-tools-0.3.3-6.el6.x8  8/8
Verifying  : libevent-1.4.13-4.el6.x86_64    1/8
Verifying  : rpcbind-0.2.0-11.el6.x86_64    2/8
Verifying  : keyutils-1.4-5.el6.x86_64      3/8
Verifying  : 1:nfs-utils-1.2.3-54.el6.x86_  4/8
Verifying  : nfs-utils-lib-1.1.5-9.el6_6.x  5/8
Verifying  : libtirpc-0.2.1-10.el6.x86_64    6/8
Verifying  : libgssglue-0.1-11.el6.x86_64    7/8
Verifying  : nfs4-acl-tools-0.3.3-6.el6.x8  8/8
Installed:
nfs-utils.x86_64 1:1.2.3-54.el6
nfs4-acl-tools.x86_64 0:0.3.3-6.el6
Dependency Installed:
keyutils.x86_64 0:1.4-5.el6
libevent.x86_64 0:1.4.13-4.el6
libgssglue.x86_64 0:0.1-11.el6
libtirpc.x86_64 0:0.2.1-10.el6
nfs-utils-lib.x86_64 0:1.1.5-9.el6_6
rpcbind.x86_64 0:0.2.0-11.el6
Complete!

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/c802f95dad183373b06a766d0ee6f4fe.html