- 论坛徽章:
- 0
|
NFS
NFS Remote Procedure Calls:
Client executes RPC call message-> Server invoked Procedure called-> Server executes procedure-> Procedure returns Request completed-> RPC return message-> Client continues execution
The portmap/rpcbind daemons are responsible for routing all incoming RPC requests to the appropriate RPC daemons on the NFS server.
If rpcbind aborts or terminates on SIGINT or SIGTERM, it will write the current list of registered services to /tmp/portmap and /tmp/rpcbind.file. Starting rpcbind with
the -w option instructs it to look for these files and start operation with the registrations found in them. This allows rpcbind to resume operation without requiring all RPC servicesto be restarted.
Clients that wish to lock a region of a file may send a request to the server's rpc.lockd daemon. rpc.lockd uses a "semaphore" to mark the requested file region "locked.” The server's rpc.statd daemon begins polling the client at regular intervals; if the client reboots unexpectedly, the server removes the lock so other clients can access the file.
TCP is the default NFS transport protocol at HP-UX 11i, but must be manually enabled on HP-UX 11.00 via the following procedure:
1. Look on the http://www.itrc.hp.com website for the latest 11.00 NFS over TCP patch. Install the patch and all its dependencies according the .text file included with the patch.
2. Reboot your system.
3. Add the NFS_TCP variable to the bottom of the /etc/rc.config.d/nfsconf file:
# vi /etc/rc.config.d/nfsconf
NFS_TCP=1
4. Stop and restart NFS.
# /sbin/init.d/nfs.server stop
# /sbin/init.d/nfs.client stop
# /sbin/init.d/nfs.client start
# /sbin/init.d/nfs.server start
NFS provides no functionality for exporting Windows file systems back to UNIX
clients.
NFS: UNIX è WINDOWS CIFS: UNIX çè WINDOWS
Configuring NFS Server
1. keep UID and GID consistent : use rcp or NIS
2. ensure the LAN/9000 and NFS subsystem are in the kernel :
sam->kernel configuration->subsystem
3. edit NFS server’s configuration file
vi /etc/rc.config.d/nfsconf
NFS_SERVER=1 :enable NFS server func; set to 0, nfs server daemon not start
NUM_NFSD=16 :the number of the nfsd daemon,means the no. of the clinets’ requests will be processed simultaneous
PCNFS_SERVER=1 :if you want to windows client have regular user access, setting it to “1”; by default 0, and windows client use UID -2,user “nobody” to access
START_MOUNTD=1 :rpc.mountd daemon will be started automatically at boot time. In 11.x must be set to 1.
NFS_TCP=1 :In 11.x, this is enable by default and no longer used.
4. start NFS server daemon
/sbin/init.d/nfs.server stop
/sbin/init.d/nfs.server start
5. create the /etc/exports file
which file system to be shared with which client by configuring /etc/exports
there are two fields in the /etc/exports: file system options
![]()
By default, root on the client is treated as user nobody.
![]()
Anon=uid : if an NFS request coms from an unknown user, grant that user the privileges normally associated with uid.
Async: increases the write performance on the NFS server by causing asynchronous writes on the NFS server.
6. export the directories
after the /etc/exports is added or modified, administrator must notify the rpc.mountd daemon by executing the exportfs command:
#exportfs –a
#exportfs lists all currently exported file systems.
#exportfs -i /home exports a file system without adding it to /etc/exports.
#exportfs –i –o ro/rw/access=host
# exportfs -u /home unexports a file system.
# exportfs -a exports all file systems listed in /etc/exports.
# exportfs -ua unexports all file systems listed in /etc/exports.
7. check the server configuration
a. check the NFS server daemons
#rpcinfo –p bjdcap7 |grep –e bind –e mountd
You have to see the “rpcbind” and “mountd” in the result.
b. check the exported file systems and the options
#showmount –e list all exported file systems
#exportfs verify the export options
c. check which clients have file systems mounted currently
#showmount –a
This command displays the contents of the /etc/rmtab file. Every time a client mounts a file system, the rpc.mountd daemon adds a line to the remote mount table in the /etc/rmtab. You can purge all entries from the /etc/rmtab file by executing: #> /etc/rmtab
Configurating NFS Client
1. Ensure the NFS subsystem is in the kernel.
2. Edit the client’s configuration file.
3. Start NFS client daemons.
4. Create a new entry in /etc/fstab
If you want to mount the NFS file systems automatically at boot time,you may edit /etc/fstab (or manually mount NFS via the mount or umount command)
![]()
5. mount the NFS file systems
#mount/umount server:/home /nfshome
#mount/umount –aF nfs
#mount/umount /nfshome
#mount –o ro server:/home /nfshome
Monitoring NFS Activity with nfsstat
#nfsstat
-c: display client rpc request only
-s: display server information
-n: display nfs information, but excludes general rpc statistics from the report
-m: display statistics for each NFS mounted file system
-r: display rpc information, but excludes nfs specific statistics
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/25852/showart_1856515.html |
|