18. 创建 OCFS2 配置文件。在 node1 上,以 root 用户身份执行
在终端窗口输入ocsf2console,选择cluster,然后选择configure nodes。
“集群堆栈已经启动”:单击 Close。
节点配置:单击 Add。
新增节点:添加以下节点,然后单击 Apply。 图示如下:

验证最终生成的配置文件
[root@node1 ~]# more /etc/ocfs2/cluster.conf
node:
ip_port = 7777
ip_address = 192.168.0.11
number = 0
name = node1
cluster = ocfs2
node:
ip_port = 7777
ip_address = 192.168.0.12
number = 1
name = node2
cluster = ocfs2
cluster:
node_count = 2
name = ocfs2
在OCFS2 控制台上选择 Cluster 和 Propagate Configuration 以将配置文件传播到 node2

配置 O2CB 驱动程序
[root@node1 ~]# /etc/init.d/o2cb unload
Stopping O2CB cluster ocfs2: OK
Unmounting ocfs2_dlmfs filesystem: OK
Unloading module "ocfs2_dlmfs": OK
Unmounting configfs filesystem: OK
Unloading module "configfs": OK
[root@node1 ~]#
[root@node1 ~]# /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]: 61
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 filesystem "ocfs2_dlmfs": OK
Mounting ocfs2_dlmfs filesystem at /dlm: OK
Starting O2CB cluster ocfs2: OK
格式化ocfs磁盘
[root@node2 /]# /etc/init.d/o2cb status
Driver for "configfs": Loaded
Filesystem "configfs": Mounted
Driver for "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Heartbeat dead threshold = 61
Network idle timeout: 30000
Network keepalive delay: 2000
Network reconnect delay: 2000
Checking O2CB heartbeat: Not active

挂载文件系统。在两个节点上以root用户执行
[root@node1 ~]# mount -t ocfs2 -o datavolume,nointr /dev/sdb1 /ocfs
要在引导时挂载文件系统,在两个节点的 /etc/fstab 中添加以下行。
/etc/fstab
/dev/sdb1 /ocfs ocfs2 _netdev,datavolume,nointr 0 0
创建 Oracle 集群件目录。在 OCR 和表决磁盘将驻留的 OCFS2 文件系统中创建目录。
在 node1 上执行
# mkdir /ocfs/clusterware
# chown -R oracle:dba /ocfs
