OCFS2 Installation & Configuration


OCFS2 Configuration High Level Steps:
- Download and install the module and tools rpms
- Create cluster.conf and propagate to all nodes
- Configure and start the O2CB cluster service
- Format the volume
- Mount the volume

Configuration Steps:
RPMs:
# rpm -qa ocfs*
ocfs2-tools-1.8.6-11.el7.x86_64

# uname -r
4.14.35-1818.3.3.el7uek.x86_64

Create cluster.conf:
# o2cb add-cluster adr12ap
# o2cb add-node adr12ap hebsap01 --ip 10.1.11.162
# o2cb add-node adr12ap hebsap02 --ip 10.1.11.163
# o2cb heartbeat-mode adr12ap global
# o2cb add-heartbeat adr12ap /dev/sdd

NOTE: IT WILL CREATE /etc/ocfs2/cluster.conf FILE in NODE1, COPY THE FILE TO REMAINING NODES IN CLUSTER. ENTRIES IN THE FILE SHOULD HAVE PROPER SPACING.


Configure O2CB:
# /sbin/o2cb.init 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) [y]:
Cluster stack backing O2CB [o2cb]:
Cluster to start on boot (Enter "none" to clear) [adr12ap]:
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
checking debugfs...
Setting cluster stack "o2cb": OK
Registering O2CB cluster "adr12ap": OK
Setting O2CB cluster timeouts : OK
NOTE: REPEAT THIS STEP IN ALL NODES IN CLUSTER

# /sbin/o2cb.init 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 "adnicr12ap": Online
  Heartbeat dead threshold: 61
  Network idle timeout: 30000
  Network keepalive delay: 2000
  Network reconnect delay: 2000
  Heartbeat mode: Local
Checking O2CB heartbeat: Not active
Debug file system at /sys/kernel/debug: mounted

# systemctl enable o2cb
Created symlink from /etc/systemd/system/multi-user.target.wants/o2cb.service to /usr/lib/systemd/system/o2cb.service.
# systemctl enable ocfs2
Created symlink from /etc/systemd/system/multi-user.target.wants/ocfs2.service to /usr/lib/systemd/system/ocfs2.service.
NOTE: REPEAT THIS STEP IN ALL NODES IN CLUSTER

Format the volume:
# fdisk -l |grep Disk
Disk /dev/sdd: 268.4 GB, 268435456000 bytes, 524288000 sectors
NOTE: VERIFY THE DISK LABEL NAME SAME ACCROSS NODES

# fdisk /dev/sdd
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xdd71e5fa.

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-524287999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-524287999, default 524287999):
Using default value 524287999
Partition 1 of type Linux and of size 250 GiB is set

Command (m for help): p

Disk /dev/sdd: 268.4 GB, 268435456000 bytes, 524288000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk label type: dos
Disk identifier: 0xdd71e5fa

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048   524287999   262142976   83  Linux

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

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

Node 2: # fdisk -l |grep sdd
Disk /dev/sdd: 268.4 GB, 268435456000 bytes, 524288000 sectors
/dev/sdd1            2048   524287999   262142976   83  Linux


# mkfs.ocfs2 -L vol01 --cluster-name=adr12ap --cluster-stack=o2cb --global-heartbeat /dev/sdd1
NOTE: USE FORCE OPTION (--force) IF FILESYSTEM ALREADY CREATED

# cat /etc/sysconfig/o2cb
NOTE: CHECK THE ENTRIES ARE SAME ACROSS ALL NODES.
# /sbin/o2cb.init load
# /sbin/o2cb.init offline
# /sbin/o2cb.init online

# /sbin/o2cb.init 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 "adr12ap": Online
  Heartbeat dead threshold: 61
  Network idle timeout: 30000
  Network keepalive delay: 2000
  Network reconnect delay: 2000
  Heartbeat mode: Global
Checking O2CB heartbeat: Active
  01BC2D8CFC674F02B423FDC1B291A588 /dev/sdd1
Nodes in O2CB cluster: 0 1
Debug file system at /sys/kernel/debug: mounted


Mount the volume:
fstab entry:
/dev/sdd1     /u04    ocfs2   _netdev,defaults     0 0

# mount -a
# mount -L vol01 /u04
# umount /u04


Reference:
# cat /etc/ocfs2/cluster.conf
cluster:
        heartbeat_mode = global
        node_count = 2
        name = adr12ap

node:
        number = 0
        cluster = adr12ap
        ip_port = 7777
        ip_address = 10.1.11.162
        name = hebsap01

node:
        number = 1
        cluster = adr12ap
        ip_port = 7777
        ip_address = 10.1.11.163
        name = hebsap02

heartbeat:
        cluster = adr12ap
        region = 01BC2D8CFC674F02B423FDC1B291A588

       
       
# cat /etc/sysconfig/o2cb
#
# This is a configuration file for automatic startup of the O2CB
# driver.  It is generated by running /etc/init.d/o2cb configure.
# On Debian based systems the preferred method is running
# 'dpkg-reconfigure ocfs2-tools'.

# O2CB_ENABLED: 'true' means to load the driver on boot.
O2CB_ENABLED=true

# O2CB_STACK: The name of the cluster stack backing O2CB.
O2CB_STACK=o2cb

# O2CB_BOOTCLUSTER: If not empty, the name of a cluster to start.
O2CB_BOOTCLUSTER=adr12ap

# O2CB_HEARTBEAT_THRESHOLD: Iterations before a node is considered dead.
O2CB_HEARTBEAT_THRESHOLD=61

# O2CB_IDLE_TIMEOUT_MS: Time in ms before a network connection is considered dead.
O2CB_IDLE_TIMEOUT_MS=30000

# O2CB_KEEPALIVE_DELAY_MS: Max time in ms before a keepalive packet is sent
O2CB_KEEPALIVE_DELAY_MS=2000

# O2CB_RECONNECT_DELAY_MS: Min time in ms between connection attempts
O2CB_RECONNECT_DELAY_MS=2000

No comments:

Post a Comment