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

时间: 2024-10-11 23:23:26

RPC和NFS的相关文章

RPC、SQL、NFS属于OSI的哪一层

第一层:物理层 第二层:数据链路层 802.2.802.3ATM.HDLC.FRAME RELAY 第三层:网络层 IP.IPX.ARP.APPLETALK.ICMP 第四层:传输层 TCP.UDP.SPX 第五层:会话层 RPC.SQL.NFS .X WINDOWS.ASP 第六层:表示层 ASCLL.PICT.TIFF.JPEG. MIDI.MPEG 第七层:应用层 HTTP,FTP,SNMP等 https://www.nowcoder.com/questionTerminal/7cf699

NFS及RPC讲解

NFS(Network File System)即网络文件系统,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操作系统能够彼此分享个别的数据,让应用程序在客户端通过网络访问位于服务器磁盘中的数据,是在类Unix系统间实现磁盘文件共享的一种方法. NFS服务简介 同时也是一种网络协议,NFS依赖RPC才能工作.(RHEL5.0上是NFS V3而RHEL6.0上是NFS V4) NFS 的基本原则是"容许不同的客户端及服务端通过一组RPC分享相同的文件系统",它

NFS网络文件系统的应用

    NFS是linux中非常常见的一种网络文件系统,其的搭建配置也非常简单,在一般的企业应用中较为广泛.下面就介绍一下NFS在企业环境中的基本应用,在应用中我们也可以更好的理解NFS网络文件系统的工作原理. 1)企业中一般应用场景 如上图一般我们要在中心服务器上设置好共享目录,由其他客户端挂在相应的共享目录,这样客户端服务器就可以想在本地一样往中心服务器上读写数据了.由上图也可以看出NFS服务一般由服务端和客户端组成. 2)rpc服务 既然想使用NFS服务就必须了解RPC服务的相关内容,因为

【CentOS】NFS服务器的安装与配置

一.系统环境 [[email protected] mnt]# cat /etc/redhat-release CentOS release 5.8 (Final) [[email protected] mnt]# uname -r 2.6.18-308.el5 [[email protected] mnt]# uname -m x86_64 [[email protected] mnt]# iptables -F #暂时关闭Linux系统防火墙 二.NFS服务器端配置 1.检查nfs与rpc(

Linux NFS (1)基本概念

NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操作系统能够彼此分享个别的数据,让应用程序在客户端通过网络访问位于服务器磁盘中的数据,是在类Unix系统间实现磁盘文件共享的一种方法. NFS 的基本原则是"容许不同的客户端及服务端通过一组RPC分享相同的文件系统",它是独立于操作系统,容许不同硬件及操作系统的系统共同进行文件的分享. NFS在文件传送或信息传

linux下配置nfs服务器以及设置自动挂载(以centos6.7为例)

NFS(百度百科):NFS(Network File System)即网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源.在NFS的应用中,本地NFS的客户端应用可以透明地读写位于远端NFS服务器上的文件,就像访问本地文件一样. NFS在文件传送或信息传送过程中依赖于RPC协议.RPC,远程过程调用 (Remote Procedure Call) 是能使客户端执行其他系统中程序的一种机制.NFS本身是没有提供信息传输的协议和功能的,但NFS

配置NFS服务器

NFS简介 NFS 即网络文件系统(Network File-System),一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.它可以通过网络,让不同机器.不同系统之间可以实现文件共享.通过 NFS,可以访问远程共享目录,就像访问本地磁盘一样.NFS只是一种文件系统,本身并没有传输功能,是基于 RPC(远程过程调用)协议实现的,采用 C/S 架构.嵌入式 Linux 开发中,通常需要在主机上配置 NFS 服务器,将某系统特定目录共享给目标系统访问和使用.通过 NFS,目标系

linux安装NFS服务器学习

一.NFS服务简介 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操作系统能够彼此分享个别的数据,让应用程序在客户端通过网络访问位于服务器磁盘中的数据,是在类Unix系统间实现磁盘文件共享的一种方法. NFS 的基本原则是"容许不同的客户端及服务端通过一组RPC分享相同的文件系统",它是独立于操作系统,容许不同硬件及操作系统的系统共同进行文件的分享. NF

nfs服务的搭建

系统环境 1. 操作系统:redhat6.5 2. 已关闭NetworkManager3. 已关闭iptables4. 已关闭SELinux5. 已配置固定的IP地址 软件环境 nfs-utils-lib.x86_64 0:1.1.5-6.el6 rpcbind.x86_64 0:0.2.0-11.el6  提供rpc协议 nfs需要rpcbind来进行通信确认 网络环境 服务器ip:192.168.1.20 客户端ip:192.168.1.25 服务器: 1. 安装软件 yum -y inst