Setup OCFS2

These are written for Debian Squeeze.

Required package

apt-get install ocfs2-tools 

Configuration

Suppose we want 2 nodes, node1 and node2, to share the fs.

Create file /etc/ocfs2/cluster.conf:

cluster.conf
node:
        ip_port = 7777
        ip_address = 192.168.0.101
        number = 0
        name = node1
        cluster = ocfs2

node:
        ip_port = 7777
        ip_address = 192.168.0.102
        number = 1
        name = node2
        cluster = ocfs2

cluster:
        node_count = 2
        name = ocfs2

Config the o2cb config file /etc/default/o2cb by:

dpkg-reconfigure ocfs2-tools

Or by hand.

Start the service

Remember to start the o2cb service.

invoke-rc.d o2cb start

You may need to online the o2cb cluster if you are joining a running one:

/etc/init.d/o2cb online

Create an OCFS2 filesystem

mkfs.ocfs2 --fs-feature-level=max-features /dev/sdb1

Remember to set enough slots for participating nodes. Read the man page of mkfs.ocfs2

Mounting an OCFS2 filesystem

At all nodes:

mount.ocfs2 -o _netdev,noatime,data=writeback /dev/sdb1 /mnt/ocfs

After success, you may something like these in dmesg

[ 1434.813381] o2net: connected to node node1 (num 0) at 192.168.0.101:7777
[ 1437.729493] ocfs2_dlm: Node 0 joins domain 571B1A408C6A486CA07FE1E2D0785806
[ 1437.729588] ocfs2_dlm: Nodes in domain ("571B1A408C6A486CA07FE1E2D0785806"): 0 1

And o2cb status:

node2:~# /etc/init.d/o2cb status
Driver for "configfs": Loaded
Filesystem "configfs": Mounted
Stack glue driver: Loaded
Stack plugin "o2cb": Loaded
Driver for "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Heartbeat dead threshold = 31
  Network idle timeout: 30000
  Network keepalive delay: 2000
  Network reconnect delay: 2000
Checking O2CB heartbeat: Active

How to cleanly shutdown a node

node2:~# umount /mnt/ocfs

node2:~# /etc/init.d/o2cb status
Driver for "configfs": Loaded
Filesystem "configfs": Mounted
Stack glue driver: Loaded
Stack plugin "o2cb": Loaded
Driver for "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Heartbeat dead threshold = 31
  Network idle timeout: 30000
  Network keepalive delay: 2000
  Network reconnect delay: 2000
Checking O2CB heartbeat: Not active   <=== changed from Active to Not active

node2:~# /etc/init.d/o2cb offline
Stopping O2CB cluster ocfs2: OK
Unloading module "ocfs2": OK

ha/setup_ocfs2.txt · Last modified: 2010-09-02 14:59 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0