Visit Counter

Tuesday, March 16, 2021

How to Setup OCFS2 on Oracle Linux

 

Env: Oracle Linux 7.6

Oracle Database: 18c

Application: Forms/Report/Webogic

=========================================================================

* Oracle RAC environment ASM file system save all binary files which related to Oracle database like  

   data files, archives files, rman backup etc...but application we cannot store to ASM system file. 

* Purpose to creating this OCFS2 cluster to Oracle Apps forms/reports shared on both node.


An OCFS2 installation consists of two parts, the kernel module and the tools module.

Install on both nodes.

1) Install the ocfs2-tools package.

# yum install -y kernel-uek ocfs2

# yum install -y ocfs2–tools-1.8.6–9


Note: Once you add-cluster "clusterapps" Generated cluster file under this path /etc/ocfs2/cluster.conf move this file to another node under same path...and create on root /ocfs2 folder for map drive.

/dev/sdd /ocfs2 ocfs2   _netdev,default 0 0

2) Create a cluster:

[root@rac01 ~]# o2cb add-cluster clusterapps


3) Add nodes to the cluster:

[root@rac01 ocfs2]# o2cb add-node clusterapps rac01.localdomain --ip 192.168.0.100

[root@rac01 ocfs2]# o2cb add-node clusterapps rac02.localdomain --ip 192.168.0.200

[root@rac01 ocfs2]# fdisk -l

4) Create Shared Disk

Add disk using VM's GUI.....I created disk 17GB....Shared Option 

Disk /dev/sda: 75.2 GB, 75161927680 bytes, 146800640 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000eada5


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1            2048    40302591    20150272   83  Linux

/dev/sda2   *    40302592    64878591    12288000   83  Linux

/dev/sda3        64878592    85358591    10240000   82  Linux swap / Solaris

/dev/sda4        85358592   146800639    30721024    5  Extended

/dev/sda5        85360640   146800639    30720000   83  Linux


Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xd63fe414


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048   104857599    52427776   83  Linux


Disk /dev/sdc: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x32a41691


   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1            2048   104857599    52427776   83  Linux


Disk /dev/sdd: 17.1 GB, 17056710656 bytes, 33313888 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xdc6f5ca7


   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1            2048    33313887    16655920   83  Linux


Note: Add new disk path in /etc/fstab

4) Add a disk-based heartbeat to the cluster:

[root@rac01 ocfs2]# o2cb add-heartbeat cluster /dev/sdd

o2cb: Unknown code ocfs 8 while reading region on device '/dev/sdd'

If you get above error while adding hearbeat...follow below steps.

[root@rac01 ocfs2]# mkfs.ocfs2 -b 4K -C 4K -J size=4M -N 4 -L myocfs2vol --cluster-name=racapps --cluster-stack=o2cb --global-heartbeat /dev/sdd
mkfs.ocfs2 1.8.6
Cluster stack: o2cb
Cluster name: racapps
Stack Flags: 0x1
NOTE: Feature extended slot map may be enabled
Label: myocfs2vol
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: 4096 (12 bits)
Volume size: 17056710656 (4164236 clusters) (4164236 blocks)
Cluster groups: 130 (tail covers 3212 clusters, rest cover 32256 clusters)
Extent allocator size: 8388608 (2 groups)
Journal size: 4194304
Node slots: 4
Creating bitmaps: done
Initializing superblock: done
Writing system files: done
Writing superblock: done
Writing backup superblock: 2 block(s)
Formatting Journals: done
Growing extent allocator: done
Formatting slot map: done
Formatting quota files: done
Writing lost+found: done
mkfs.ocfs2 successful

[root@rac01 ocfs2]# o2cb add-heartbeat clusterapps /dev/sdd


[root@rac01 init.d]# /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) [ocfs2]: clusterapps 

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 "clusterapps": OK

Setting O2CB cluster timeouts : OK

[root@rac01 init.d]# /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 "clusterapps": Online

  Heartbeat dead threshold: 31

  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

[root@rac01 init.d]# 

[root@rac01 init.d]# /sbin/o2cb.init online

checking debugfs...

Setting cluster stack "o2cb": OK

Cluster racapps already online

[root@rac01 init.d]# 

[root@rac01 init.d]# mkfs.ocfs2 /dev/sdd

mkfs.ocfs2 1.8.6

On disk cluster (o2cb,racapps,1) does not match the active cluster (o2cb,racapps,0).

mkfs.ocfs2 will not be able to determine if this operation can be done safely.

To skip this check, use --force or -F

[root@rac01 init.d]# systemctl enable o2cb

Created symlink from /etc/systemd/system/multi-user.target.wants/o2cb.service to /usr/lib/systemd/system/o2cb.service.

[root@rac01 init.d]# systemctl enable ocfs2

Created symlink from /etc/systemd/system/multi-user.target.wants/ocfs2.service to /usr/lib/systemd/system/ocfs2.service.

[root@rac01 init.d]# 

[root@rac01 init.d]# sysctl kernel.panic=30

kernel.panic = 30

[root@rac01 init.d]# sysctl kernel.panic_on_oops=1

kernel.panic_on_oops = 1


[root@rac01 init.d]# /sbin/o2cb.init staus

Usage: /sbin/o2cb.init {start|stop|restart|force-reload|enable|disable|configure|load|unload|online|offline|force-offline|status|online-status}

[root@rac01 init.d]# /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 "clusterapps": Online

  Heartbeat dead threshold: 31

  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




[root@rac01 ocfs2]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda2        12G  9.0G  2.8G  77% /

devtmpfs        4.7G     0  4.7G   0% /dev

tmpfs           4.7G  148K  4.7G   1% /dev/shm

tmpfs           4.7G   58M  4.6G   2% /run

tmpfs           4.7G     0  4.7G   0% /sys/fs/cgroup

/dev/sda5        30G   25G  4.8G  84% /u02

/dev/sda1        20G  4.2G   16G  22% /u01

tmpfs           945M   20K  945M   1% /run/user/54321

/dev/sr0         59M   59M     0 100% /run/media/oracle/VBox_GAs_6.1.16

/dev/sdd         16G  852M   16G   6% /ocfs2


Help

=====

[root@rac01 ocfs2]# o2cb add-cluster --help

o2cb: Cluster name is invalid ; only alpha-numeric characters allowed

[root@rac01 ocfs2]# o2cb --help

usage: o2cb [--config-file=path] [-h|--help] [-v|--verbose] [-V|--version] COMMAND [ARGS]


The commands are:

  add-cluster         Add cluster to the config file.

  remove-cluster      Removes cluster from the config file.

  add-node            Adds a node to the cluster in the config file.

  remove-node         Removes a node from the cluster in the config file.

  add-heartbeat       Adds a heartbeat region to the cluster in the config file.

  remove-heartbeat    Removes a heartbeat region from the cluster in the config file.

  heartbeat-mode      Toggles the heartbeat mode between global and local.

  list-clusters       Lists all the cluster names in the config file.

  list-cluster        Lists all the nodes and heartbeat regions associated with the cluster in the config file.

  list-nodes          Lists all the nodes associated with the cluster in the config file. 

  list-heartbeats     Lists all the heartbeat regions associated with the cluster in the config file.

  register-cluster    Registers the cluster with configfs.

  unregister-cluster  Unregisters the cluster from configfs.

  start-heartbeat     Starts global heartbeat.

  stop-heartbeat      Stops global heartbeat.

  cluster-status      Returns 0 if cluster online, 1 otherwise.





















1 comment:

  1. Hi,
    Pls guide me what action run on your node: rac02

    How shared rac02 see the disk "/dev/sdd 16G 852M 16G 6% /ocfs2" in rac01

    ReplyDelete