rac的共享存储有很多种搭建方式,nfs是其中一种。生产环境一般不采用nfs,多用于测试。
nfs搭建步骤大致分为如下:
1.划盘
给节点1挂载一块磁盘,并将磁盘分区,并格式化,再挂载
[root@news01 softdb]# fdisk -l Disk /dev/vda: 53.6 GB, 53687091200 bytes 255 heads, 63 sectors/track, 6527 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vda1 * 1 13 104391 83 Linux /dev/vda2 14 5482 43929742+ 83 Linux /dev/vda3 5483 6526 8385930 82 Linux swap / Solaris Disk /dev/vdb: 53.6 GB, 53687091200 bytes 16 heads, 63 sectors/track, 104025 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/vdb1 1 58130 29297488+ 83 Linux
我们把其中的/dev/vdb1 作为NFS磁,再将/dev/vdb1格式化
[root@news01 softdb]# mkfs.ext3 /dev/vdb1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 3662848 inodes, 7324372 blocks 366218 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 224 block groups 32768 blocks per group, 32768 fragments per group 16352 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 23 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
2.配置服务端
格式化好之后,创建一个目录来挂载磁盘,并编辑exports文件,重启和nfs有关的服务
[root@news01 softdb]# mkdir -p /nfsdatafile [root@news01 softdb]# vi /etc/exports [root@news01 softdb]# mount /dev/vdb1 /nfsdatafile/ [root@news01 softdb]# service portmap restart Stopping portmap: [ OK ] Starting portmap: [ OK ] [root@news01 softdb]# service nfs restart Shutting down NFS mountd: [FAILED] Shutting down NFS daemon: [FAILED] Shutting down NFS quotas: [FAILED] Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ] [root@news01 softdb]# showmount -e Export list for news01: /nfsdatafile * [root@news01 softdb]#
3.客户端挂载
在需要挂载这个nfs的节点上面,编辑fstab文件,再进行mount。需要注意的一点是,oracle的rac对nfs的参数有做要求,具体可以参考:
Mount Options for Oracle files when used with NAS devices [ID 359515.1]
节点1:
[root@news01 softdb]# mkdir /nfs [root@news01 softdb]# vi /etc/fstab [root@news01 softdb]# cat /etc/fstab LABEL=/ / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 LABEL=SWAP-vda3 swap swap defaults 0 0 192.168.0.188:/nfsdatafile /nfs nfs rw,bg,hard,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0 0 0 [root@news01 softdb]# mount -a [root@news01 softdb]# mount /dev/vda2 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/vda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) /dev/vdb1 on /nfsdatafile type ext3 (rw) nfsd on /proc/fs/nfsd type nfsd (rw) 192.168.0.188:/nfsdatafile on /nfs type nfs (rw,bg,hard,rsize=32768,wsize=32768,tcp,nfsvers=3,timeo=600,actimeo=0,addr=192.168.0.188) [root@news01 softdb]#
节点2:
[root@news02 softdb]# mkdir /nfs [root@news02 softdb]# vi /etc/fstab [root@news02 softdb]# mount -a [root@news02 softdb]# mount /dev/vda2 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/vda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) 192.168.0.188:/nfsdatafile on /nfs type nfs (rw,bg,hard,rsize=32768,wsize=32768,tcp,nfsvers=3,timeo=600,actimeo=0,addr=192.168.0.188) [root@news02 softdb]#
4.测试
以上就把2个节点的nfs配置好了,测试的时候,可以在任意一个节点的nfs目录做rw操作,再在另外一个节点查看能否正常rw。
[root@news02 nfs]# vi abc.txt [root@news02 nfs]# cat abc.txt 123123 [root@news02 nfs]# ll total 20 -rw-r--r-- 1 root root 7 Mar 1 2014 abc.txt drwx------ 2 root root 16384 Mar 1 21:32 lost+found [root@news02 nfs]#
[root@news01 softdb]# cd /nfs [root@news01 nfs]# ll total 20 -rw-r--r-- 1 root root 7 Mar 1 21:45 abc.txt drwx------ 2 root root 16384 Mar 1 21:32 lost+found [root@news01 nfs]# more abc.txt 123123 [root@news01 nfs]#
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:在linux配置NFS用于RAC的搭建 - Python技术站