首页 > Linux操作系统 > Linux操作系统 > Linux 上配置、使用NFS
如果使用NFS存储Oracle数据库的数据文件,直接跳过下面的配置,参考文章最后的“参考文章”内容,如果用于存储普通文件即参考如下配置:
一.服务器端配置:
1.查看是否安装了nfs-utils portmap包:
#rpm -qa nfs-utils portmap (客户端和服务器端都需要安装这两个包)
portmap-4.0-65.2.2.1
nfs-utils-1.0.9-42.el5
注意:redhat 6开始没有portmap这个包。
如果未安装,需要安装这2个包。
2.创建NFS存储:
创建单独分区mount到/testnfs,或者直接在根目录下创建testnfs文件夹。
3.提供NFS服务:
编辑/etc/exports文件
加入
/testnfs *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
4.重启portmap和nfs服务:
#service portmap restart
#service nfs restart
二.客户端配置:
1.创建挂载的目录:
在根目录下创建testnfs文件夹。
2.将远程服务器的目录挂载到本地:
#mount 172.168.6.112:/testnfs /testnfs
3.检查是否挂载成功:
#mount
172.168.6.112:/testnfs on /testnfs type nfs (rw,addr=172.168.6.112)
4.设置启动挂载:
编辑/etc/fstab
加入
172.168.6.112:/testnfs /testnfs nfs rw,addr=172.168.6.112 0 0
如果想进一步了解NFS的参数含义,可以在Linux平台执行man nfs查看相关的内容,如下常见参数含义:
soft If an NFS file operation has a major timeout then report an I/O error to the calling program. The default is to continue retrying NFS file operations indefinitely.
hard If an NFS file operation has a major timeout then report "server not responding" on the console and continue retrying indefinitely. This is the default.
intr If an NFS file operation has a major timeout and it is hard mounted, then allow signals to interupt the file operation and cause it to return EINTR to the calling program. The default is to not allow file operations to be interrupted.
5.在NFS服务器端使用showmount命令检查客户端MOUNT情况:
>显示NFS客户端信息
#showmount
>显示指定NFS服务器连接NFS客户端的信息
#showmount 192.168.1.1 #此ip为nfs服务器的
>显示输出目录列表
#showmount -e
>显示指定NFS服务器输出目录列表(也称为共享目录列表)
#showmount -e 192.168.1.1
>显示被挂载的共享目录
#showmount -d
>显示客户端信息和共享目录
#showmount -a
>显示指定NFS服务器的客户端信息和共享目录
#showmount -a 192.168.1.1
6.测试:
在两台机器上对这个文件夹下的文件进行读写操作测试。
至此,linux下的nfs简单配置就完成了。
参考文章:
《Mount Options for Oracle files when used with NFS on NAS devices (文档 ID 359515.1)》:http://blog.itpub.net/23135684/viewspace-625315/
如果是11gR2 RAC在Linux平台使用NFS的话,请参考文章:http://space.itpub.net/23135684/viewspace-734873/
--end--
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29615408/viewspace-1384953/ ,如需转载,请注明出处,否则将追究法律责任。