使用NFS实现AIX之间文件网络共享


http://www.cnblogs.com/macrohu/archive/2013/05/27/3101179.html


AIX 上使用NFS实现AIX之间文件网络共享

tomroom.cublog.cn  作者:tomroom 环保男  环境AIX 6.1

       AIX 可以使用NFS在AIX之间实现类似window共享文件夹功能,在多台aix上安装系统补丁的时候比较有用只需要在一台服务器上FTP上传,其他AIX通过共享访问(注意不要多台一起访问可能会由于I/O繁忙带有问题)

注意:

1.         多台AIX之前在同一个局域网子网段中没有问题,若跨网段请确认网络开通NFS端口

2.         下面我都是用root账户登录操作

3.         要在A,B两端的/etc/hosts里互相都加上彼此的IP地址和hostname(若不用DNS都通过hosts表里name

 

l  第一部分在AIX服务器A 上面建里要通过NFS共享的目录比如:根目录下/test目录

# ls -l

total 8

-rw-r-----    1 root     system          543 Jul 24 03:39 temp.txt

/test目录中存放一个文件temp.txt内容如下,后面可以用这个验证共享成功

# cat temp.txt

SBMJOB CMD(STROBJCVN LIB(*ALLUSR))

       LOG(4 0 *SECLVL)            

 

 

 

S6564E5B

定时任务 DAILY4  HOLD

 

磁带机中磁带 卷标 001176推入磁带机TAP07

 

Opt  Queue Manager                                     Port 

     HHT                                                1417

                                                            

 

MQM HHT

 

 

Opt  Queue Manager                                     Port   

     HHT                                                1414  

     HHT                                                1417  

A机器上运行# smit nfs

先选择Network File System (NFS)

 

                                                              NFS

 

Move cursor to desired item and press Enter.

 

  Configure TCP/IP (If Not Already Configured)

  Network File System (NFS)

  Network Information Service (NIS)

  Configure Secure NFS & NIS

 

再选择Add a Directory to Exports List(先Change / Show Attributes of an Exported Directory确认目录之前没有被Exported

                                                  Network File System (NFS)

 

Move cursor to desired item and press Enter.

 

  Configure NFS on This System

  Add a Directory to Exports List

  Change / Show Attributes of an Exported Directory

  Remove a Directory from Exports List

  Add a File System for Mounting

  Change / Show Attributes of an NFS File System

  Remove an NFS File System

  Flush NFS V4 Translation Cache

  Add NFSv4 File System FSID Options

  Change / Show NFSv4 File System FSID Options

  Reset NFSv4 File System FSID Options

下面画面中* Pathname of directory to export 输入导出目录路径和名称    [/test]

 

                                               Add a Directory to Exports List

 

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

 

[TOP]                                                   [Entry Fields]

* Pathname of directory to export                    [/test]                  

  Anonymous UID                                      [-2]

  Public filesystem?                                  no                       

* Export directory now, system restart or both        both                    

       []                       

 

 

运行完成之后如下提示

                                                       COMMAND STATUS

 

Command: running       stdout: yes           stderr: no

 

Before command completion, additional instructions may appear below.

 

0513-059 The nfsd Subsystem has been started. Subsystem PID is 5505044.

0513-059 The rpc.mountd Subsystem has been started. Subsystem PID is 7077952.

 

l  第二部分在另外一台服务器B上

运行smitty nfs选择Network File System (NFS)

                                                             NFS

 

Move cursor to desired item and press Enter.

 

  Configure TCP/IP (If Not Already Configured)

  Network File System (NFS)

  Network Information Service (NIS)

  Configure Secure NFS & NIS

B机器上选择Add a File System for Mounting

                                                  Network File System (NFS)

 

Move cursor to desired item and press Enter.

 

  Configure NFS on This System

  Add a Directory to Exports List

  Change / Show Attributes of an Exported Directory

  Remove a Directory from Exports List

  Add a File System for Mounting

  Change / Show Attributes of an NFS File System

  Remove an NFS File System

  Flush NFS V4 Translation Cache

  Add NFSv4 File System FSID Options

  Change / Show NFSv4 File System FSID Options

  Reset NFSv4 File System FSID Options

Pathname of mount point 填B机上mount点

Pathname of remote directory填A机上路径

Host where remote directory resides填A机主机名(在A机器上运行hostname获得)

                                               Add a File System for Mounting

 

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

 

[TOP]                                                   [Entry Fields]

* Pathname of mount point                           [/tmp/test/]                  

* Pathname of remote directory                       [/test]

* Host where remote directory resides                [svr05427]

  Mount type name                                    []

* Security method                                    [sys]                         

* Mount now, add entry to /etc/filesystems or both?   now                           

* /etc/filesystems entry will mount the directory     no                           

   on system restart.

 

 

注意: 要在A,B两端的/etc/hosts里互相都加上彼此的IP地址和hostname

若提示not in hosts database 需要修改B机器上/etc/hosts文件增加A服务器的IP地址和hostname

 

                                                       COMMAND STATUS

 

Command: failed        stdout: yes           stderr: no

 

Before command completion, additional instructions may appear below.

 

mount: 1831-009 svr05427 not in hosts database

mount: 1831- 008 giving up on:

svr05427:/test

A route to the remote host is not available.

 

若有如下错误可能网络上没有开放NFS需要的端口

                                                       COMMAND STATUS

 

Command: failed        stdout: yes           stderr: no

 

Before command completion, additional instructions may appear below.

 

nfsmnthelp: 1831-019 svr05427: System call error number -1.

 

mount: 1831- 008 giving up on:

svr05427:/test

System call error number -1.

成功之后可以在B机上smit mount中 List all能看到mount上文件验证,并访问共享文件内容确认可以访问

 

l  卸载

取消在B机上可以用smit umount指定上面B机上mount点可以在B机器上取消该NFS

在A机器上卸载,smit nfs选择Remove a Directory from Exports List 输入路径

 

                                                  Network File System (NFS)

 

Move cursor to desired item and press Enter.

 

  Configure NFS on This System

  Add a Directory to Exports List                      

  Change / Show Attributes of an Exported Directory  

  Remove a Directory from Exports List

  Add a File System for Mounting

  Change / Show Attributes of an NFS File System     

  Remove an NFS File System

  Flush NFS V4 Translation Cache

  Add NFSv4 File System FSID Options

  Change / Show NFSv4 File System FSID Options

  Reset NFSv4 File System FSID Options

 

l  权限

我两台机器都是用root账户访问权限两台都是如下一样

# ls -l

total 8

-rw-r-----    1 root     system          543 Jul 24 06:10 temp.txt

l  附录

l  windows端也能访问AIX NFS ,也有建议window访问aix文件系统SAMBA比NFS好

比如:http://www.chinaunix.net/jh/9/503373.html

经常碰到一些客户需要将PC Server的数据定期放到运行AIX操作系统的6000小机的 磁带机上备份,做了几个这样的案例 Share一下:) 
1、下载SFU 
     SFU是微软的一款与UNIX系统进行文件共享的软件 100M左右。可在Windows端模拟NFS Server 或者使 Windows成为NFS Client。他是免费的。下载时需要.net帐户(msn的就行) 
2、在Windows端安装SFU软件。选择作为NFS Client。安装时间较长。安装结束后可以在网上邻居中发现新增加了一个叫做SFU的 工作组(好像是这个名字) 
在上面点击右键选择添加,将6000的IP地址加入。在6000一端开启NFS服务。刷新后就可看到该服务器了 
3、身分认证:在两端建立相同帐号,需要在6000上编辑/etc/hosts文件。将需要访问NFS路径的服务器IP地址与机器名称加入。这是 在PC Server端就可以访问该共享文件夹了。在上面还可进行权限的管理 有兴趣的自己实验吧。 

最后:使用Windows备份策略定期将被分文件写入该文件夹。在AIX上编辑crontab即可。


你可能感兴趣的:(使用NFS实现AIX之间文件网络共享)