OCFS2

From Segfault
Jump to navigation Jump to search

Prerequisites

 $ apt-get install ocfs2-tools

We have to setup a real interface on both nodes too:

 $ cat /etc/network/interfaces
 [...]
 auto eth0:1
 iface eth0:1 inet static
       address 10.0.0.100
       netmask 255.255.255.0
 
 $ ifup eth0:1

Installation

 $ cat /etc/ocfs2/cluster.conf 
 cluster:
       node_count = 2
       name = ocfs2
 
 node:
       ip_port = 7777
       ip_address = 10.0.0.100
       number = 0
       name = node0
       cluster = ocfs2
 
 node:
       ip_port = 7777
       ip_address = 10.0.0.101
       number = 1
       name = node1
       cluster = ocfs2
 $ grep ^O /etc/default/o2cb 
 O2CB_ENABLED=true
 O2CB_BOOTCLUSTER=ocfs2
 O2CB_HEARTBEAT_THRESHOLD=31
 O2CB_IDLE_TIMEOUT_MS=30000
 O2CB_KEEPALIVE_DELAY_MS=2000
 O2CB_RECONNECT_DELAY_MS=2000

Now we can start OCFS2, on both nodes:

 $ /etc/init.d/ocfs2 start

Usage

Now that o2cb (cluster stack for the OCFS2 file system) is running, we can add disks to the cluster. On one of the cluster nodes, we do:

 $  mkfs.ocfs2 /dev/sdb

Now, we can mount /dev/sdb on each cluster node:

 $ mount -t ocfs2 /dev/sdb /mnt/ocfs2
 
 $ mounted.ocfs2 -f
 Device                FS     Nodes
 /dev/sdb              ocfs2  node1, node0

Links