① 安装ocfs-tools-1.8

   如果是使用RedHat Enterprise Linux 6.4,也可以安装ocfs-tools-1.8的,只是要插入Oracle Linux Server release 6.4的光盘
   yum instll ocfs2-tools   
   会产生以下文件及目录

         一、/etc/init.d/o2cb 服务脚本
         二、/etc/ocfs2/ 配置文件路径
         三、/sbin/o2cb

② 使用/etc/init.d/o2cb configure 配置
    /etc/init.d/o2cb configure


Configuring the O2CB driver.

This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot.  The current values will be shown in brackets ('[]').  Hitting
<ENTER> without typing an answer will keep that current value.  Ctrl-C
will abort.

Load O2CB driver on boot (y/n) [n]: y
Cluster stack backing O2CB [o2cb]:
Cluster to start on boot (Enter "none" to clear) []: ocfs2
Specify heartbeat dead threshold (>=7) [31]:
Specify network idle timeout in ms (>=5000) [30000]:
Specify network keepalive delay in ms (>=1000) [2000]:
Specify network reconnect delay in ms (>=2000) [2000]:
Writing O2CB configuration: OK
Loading filesystem "configfs": OK
Mounting configfs filesystem at /sys/kernel/config: OK
Loading stack plugin "o2cb": OK
Loading filesystem "ocfs2_dlmfs": OK
Mounting ocfs2_dlmfs filesystem at /dlm: OK
Setting cluster stack "o2cb": OK
Checking O2CB cluster configuration : Failed

最后一个出错,原因在于第五步没有配置

   
③ fdisk /dev/sdl 分区


   WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): p

Disk /dev/sdl: 20.5 GB, 20468203520 bytes
64 heads, 32 sectors/track, 19520 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x84f019f9

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19520, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-19520, default 19520):
Using default value 19520

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


④ 格式化分区,这一步一定要先于第五步执行

    mkfs.ocfs2 -b 4k -C 32k -N 2 -L oracle /dev/sdl1


mkfs.ocfs2 1.8.0
Cluster stack: classic o2cb
Overwriting existing ocfs2 partition.
WARNING: Cluster check disabled.
Proceed (y/N): y
Label: oracle
Features: sparse extended-slotmap backup-super unwritten inline-data strict-journal-super xattr indexed-dirs refcount discontig-bg
Block size: 4096 (12 bits)
Cluster size: 32768 (15 bits)
Volume size: 20468170752 (624639 clusters) (4997112 blocks)
Cluster groups: 20 (tail covers 11775 clusters, rest cover 32256 clusters)
Extent allocator size: 12582912 (3 groups)
Journal size: 127926272
Node slots: 2
Creating bitmaps: done
Initializing superblock: done
Writing system files: done
Writing superblock: done
Writing backup superblock: 3 block(s)
Formatting Journals:


⑤ 配置Cluster,主要就是通过命令的方式配置/etc/ocfs2/cluster.conf

   o2cb add-cluster ocfs2
   o2cb add-node --ip 192.168.202.10 ocfs2 node1
   o2cb add-node --ip 192.168.202.11 ocfs2 node2
   o2cb add-heartbet ocfs2 /dev/sdl1(做这一步的前提是该设备已经格式化为ocfs2文件系统)
   o2cb register-cluster ocfs2
   (如果不注册的话,始终无法挂载)
   另外还有其他的一些命令:
   o2cb list-cluster ocfs2
   o2cb cluster-status ocfs2
          如果是offline,则表明没做add-heartbet和register-cluster动作

⑥ 添加ocfs2文件系统挂载点   
   mkdir /u01/OCFS_DATA
   修改 /etc/fstab ,增加条目
   /dev/sdl1  /u01/OCFS_DATA ocfs2 _netdev,datavolume,nointr  0  0

  mount /dev/sdl1 --立即生效

⑦ 在其他节点,重复①②⑤⑥,③④步骤无需再做,

    如果未发现磁盘,可以使用partprobe探测

posted on 2014-03-25 17:16  Shark Xu  阅读(3455)  评论(0编辑  收藏  举报
为汶川地震死难者哀悼!