RPC和NFS
参考:http://eduunix.ccut.edu.cn/index2/html/linux/OReilly.SUSE.Linux.Jul.2006/059610183X/suselinux-CHP-7-SECT-3.html
上面的链接基于suse,说的不错
Function
The RPC system is intended as functions to be integrated into network programs rather than as a command-line operations. An RPC, as part of a program running on a client computer, sends a message to a remote server. This message includes a command and required parameters. The command being executed must be a program residing on the remote computer. It does not need to be locally available.
NFS Procedures
The Network File System is the best known example of RPC usage. Under NFS, files are held on a remote server but appear to be available locally. Local programs want to access a file and do so by calling a procedure on the remote server, rather than accessing a local process.
Execution
RPC is implemented by compiling a client program and a server program on each computer. Calls to these programs are implemented by a series of functions available in the "C" programming language. The RPC libraries need to be included in the header of the program and then RPC functions like rpc_call() can be used within the "C" program.
RPC Protocol Overview
The Remote Procedure Call (RPC) protocol, documented in RFC 1831, is designed to augment IP in a different way than TCP. While TCP is targeted at the transfer of large data streams (such as a file download), RPC is designed for network programming, allowing a program to make a subroutine call on a remote machine. The most important application of RPC is the NFS file sharing protocol.
The key features of RPC are:
- Request-reply. RPC is a request-reply protocol, and can exhibit the "ping-pong" behavior typical of such protocols. This is not fundamental to RPC's design (since multiple requests can be outstanding, and replys can come in any order), but most programs will issue a single RPC request, and then block awaiting a reply.
- UDP or TCP transport. RPC actually operates over UDP or TCP. RPC/UDP is a connection-less, stateless protocol. RPC/TCP is slower, but provides a reliable, stateful connection.
- Standardized data representation. RPC encodes its data using the eXternal Data Representation (XDR) protocol, documented in RFC 1832, which standardizes the format of integers, floating point numbers, and strings, permitting different types of computers to enhance information seamlessly.
- Authentication. RPC provides support for authenticating the calling program on one machine to the target subroutine on the other. Authentication can operate in several different modes. During NFS operations, authentication usually takes the form of relaying UNIX user and group IDs to the file server for permission checking.
RPC Service Rendezvous
Both TCP and UDP rely on well-known port numbers to perform service rendezvous. For example, TCP TELNET service is available on port 21, FTP on port 23, SMTP on port 25, and so on. Connecting to TCP and UDP services simply requires connecting to the right port number.
RPC introduces another step in this process, to divorce services from being tied to a given port number. It does so using a special RPC service called PORTMAP or RPCBIND. These binding protocols, documented in RFC 1833 and often referred to as the portmapper, are unique among RPC services since they have an assigned port of their own (port 111). Other RPC services, running on any port number, can register themselves using an RPC call to port 111. The portmapper offers other RPC calls to permit service lookup.
The most important consequence of this design is that the portmapper must be the first RPC program started, and must remain in constant operation.
NFS Protocol Overview
The Network File System (NFS), developed by Sun Microsystems, is the de facto standard for file sharing among UN*X hosts. NFS Version 3 is documented in RFC 1813. The Mount Protocol is closely related.
NFS is implemented using the RPC Protocol, designed to support remote procedure calls. All NFS operations are implemented as RPC procedures. A summary of NFS procedures is show below:
Procedure 0: NULL - Do nothing
Procedure 1: GETATTR - Get file attributes
Procedure 2: SETATTR - Set file attributes
Procedure 3: LOOKUP - Lookup filename
Procedure 4: ACCESS - Check Access Permission
Procedure 5: READLINK - Read from symbolic link
Procedure 6: READ - Read From file
Procedure 7: WRITE - Write to file
Procedure 8: CREATE - Create a file
Procedure 9: MKDIR - Create a directory
Procedure 10: SYMLINK - Create a symbolic link
Procedure 11: MKNOD - Create a special device
Procedure 12: REMOVE - Remove a File
Procedure 13: RMDIR - Remove a Directory
Procedure 14: RENAME - Rename a File or Directory
Procedure 15: LINK - Create Link to an object
Procedure 16: READDIR - Read From Directory
Procedure 17: READDIRPLUS - Extended read from directory
Procedure 18: FSSTAT - Get dynamic file system information
Procedure 19: FSINFO - Get static file system Information
Procedure 20: PATHCONF - Retrieve POSIX information
Procedure 21: COMMIT - Commit cached data on a server to stable storage
NFS is a stateless protocol. This means that the file server stores no per-client information, and there are no NFS "connections". For example, NFS has no operation to open a file, since this would require the server to store state information (that a file is open; what its file descriptor is; the next byte to read; etc). Instead, NFS supports a Lookup procedure, which converts a filename into a file handle. This file handle is an unique, immutable identifier, usually an i-node number, or disk block address. NFS does have a Read procedure, but the client must specify a file handle and starting offset for every call to Read. Two identical calls to Read will yield the exact same results. If the client wants to read further in the file, it must call Read with a larger offset.
Of course, this is seldom seen by the end user. Most operating systems provide system calls to open files, and read from them sequentially. The client's operating system must maintain the required state information, and translate system calls into stateless NFS operations.
NFS Performance
NFS performance is closely related to RPC performance. Since RPC is a request-reply protocol, it exhibits very poor performance over wide area networks. NFS performs best on fast LANs.


Read more : http://www.ehow.com/facts_6884305_rpc-protocol.html
RPC和NFS的更多相关文章
- RPC、SQL、NFS属于OSI的哪一层
第一层:物理层 第二层:数据链路层 802.2.802.3ATM.HDLC.FRAME RELAY 第三层:网络层 IP.IPX.ARP.APPLETALK.ICMP 第四层:传输层 TCP.UDP. ...
- NFS及RPC讲解
导读 NFS(Network File System)即网络文件系统,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操作系统能够彼此分享个别的数据,让应用程序在客户端通过网 ...
- linux NFS 配置步骤
转载 http://woxihuanpes.blog.163.com/blog/static/12423219820097139145238/ NFS server可以看作是一个FILE SERVER ...
- Linux NFS服务器的安装与配置
一.NFS服务简介 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操 ...
- How to build a NFS Service
NFS网络文件系统的服务的配置 1 Preparation Three Linux virtual machines one: to be NFS Service the other two: NFS ...
- NFS
测试版本:CentOS 6.4 64b NFS监听2049(TCP/UDP)端口,但由于文件系统非常复杂,不同的功能都会使用不同的程序来启动,因此额外端口就会不固定(随机1024以下的),这就需要向远 ...
- 4412开发板学习笔记-NFS服务器的搭建
转自iTOP-4412讨论群: http://www.topeetboard.com 先来介绍一下NFS: NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件 ...
- (转)Linux NFS服务器的安装与配置
转自:http://www.cnblogs.com/mchina/archive/2013/01/03/2840040.html 由于在6系列里面,portmap已经改名了 ,6系列需要使用 serv ...
- NFS服务器原理
NFS服务器 port:2049 NFS 为 Network FileSystem 的简称,它的目的就是想让不同的机器.不同的操作系统可以彼此分享个别的档案啦!目前在 Unix Like ...
随机推荐
- VB6.0 读取CSV文件
最近做了一个Upload文件的需求,文件的格式为CSV,读取文件的方法整理了一下,如下: 1.先写了一个读取CSV文件的Function: '读取CSV文件 '假设传入的参数strFile=C:\Do ...
- HLSL之漫反射光
整整忙了一个月了,总算清闲下来了,从上次写完环境光后又过了这么长时间,继续学习......加油!!今天整理下漫反射光并记录下来,那就直接进入主题吧,开始漫反射光的学习. 漫反射光是在环境光的基础上添加 ...
- Browser增加下载路径选择功能
SWE Browser中有xml/download_settings_preferences.xml, 但在代码中却没有调用,导致“设置”中没有”选择下载路径“功能. 在com.android.bro ...
- ubuntu12.04安装svn 1.7(转载)
ubuntu12.04安装svn 1.7 分类: ubuntu2013-10-22 16:03 239人阅读 评论(0) 收藏 举报 svnubuntu 目录(?)[+] 1.问题 在 ...
- ab压力测试和CC预防
这两天从服务器上拉数据时,发现取回的数据不正确,而客户端当初健壮性不强,导致解析的数据为空. 起初以为是服务器维护的问题,可今天服务器登陆上了,发现还是数据不正确,正好昨天数据部的哥们告诉了我一个比较 ...
- Java 第14章 字符串
字符串 基本数据类型和引用数据类型作为方法参数 ,在传递时有什么不同之处. 答:基本数据类型按值传递,相当于复制了一份过去. 引用数据类型是指向引用 内存地址,两个地方 根据地址使用同一份数据,如被更 ...
- C# async await 学习笔记2
C# async await 学习笔记1(http://www.cnblogs.com/siso/p/3691059.html) 提到了ThreadId是一样的,突然想到在WinForm中,非UI线程 ...
- Linux内核分析之操作系统是如何工作的
在本周的课程中,孟老师主要讲解了操作系统是如何工作的,我根据自己的理解写了这篇博客,请各位小伙伴多多指正. 一.知识点总结 1. 三个法宝 存储程序计算机:所有计算机基础性的逻辑框架. 堆栈:高级语言 ...
- Agile Software Development ——敏捷开发
敏捷? 过去几年中,软件行业中出现了一个新词汇——agile:与此同时,一个关于新的软件开发方式的变革正悄然兴起. 在老师的引导下,我阅读了Agile Guide网站上的几篇文章,并查阅了相关资料.不 ...
- node-webkit教程(16)调试typescript
原文链接:node-webkit教程(16)调试typescript 本文所讲的内容同样适用于chrome浏览器. 在chrome的开发人员工具的配置项中,有一个sourcemap的选项,用来配置ja ...