Oracle Database in Pacemaker Corosync Cluster

Configuring an lvm volume with an ext4 file system

  1. Create an LVM physical volume

    pvcreate /dev/sdb1
    pvcreate /dev/sdc1
  2. Create the volume group

    vgcreate data_vg /dev/sdb1
    vgcreate arch_vg /dev/sdc1
  3. Create a logical volume

    lvcreate -l 100%FREE -n data_lv data_vg
    lvcreate -l 100%FREE -n arch_lv arch_vg
  4. Create an ext4 file system

    mkfs.ext4 /dev/data_vg/data_lv
    mkfs.ext4 /dev/arch_vg/arch_lv

Exclusive activation of a volume group in a cluster (HA-LVM)

  1. Execute the following command to ensure that locking_type is set to 1 and that use_lvmetad is set to 0 in the /etc/lvm/lvm.conf file. This command also disables and stops any lvmetad processes immediately.

    lvmconf --enable-halvm --services --startstopservices
  2. Determine which volume groups are currently configured on your local storage with the following command.

    ~]# vgs --noheadings -o vg_name
    arch_vg
    data_vg
    rhel
  3. Add the volume groups other than data_vg/arch_vg (the volume group you have just defined for the cluster) as entries to volume_list in the /etc/lvm/lvm.conf configuration file.

    volume_list = [ "rhel" ]
  4. Rebuild the initramfs boot image to guarantee that the boot image will not try to activate avolume group controlled by the cluster. Update the initramfs device with the following command. This command may take up to a minute to complete.

    dracut -H -f /boot/initramfs-$(uname -r).img $(uname -r)
  5. Reboot the node.

  6. Start clusterservices on each of the nodes with the following command.

    pcs cluster start --all

Creating resources and resource groups

  1. Create LVM resource.

    pcs resource create data001_vg LVM volgrpname=data001_vg exclusive=true --group ora_grp
    pcs resource create arch001_vg LVM volgrpname=arch001_vg exclusive=true --group ora_grp
  2. Create Filesystem resource.

    pcs resource create data001 Filesystem \
    device="/dev/data001_vg/data001_lv" directory="/data001" fstype="xfs" --group ora_grp
    pcs resource create arch001 Filesystem \
    device="/dev/arch001_vg/arch001_lv" directory="/arch001" fstype="xfs" --group ora_grp
  3. Create VirtualIP resource.

    pcs resource create vip1 IPaddr2 ip=192.168.184.146 \
    cidr_netmask=24 nic=ens32 --group ora_grp
  4. Create Oracle Database Listener resource.

    pcs resource create coco_lsnr oralsnr \
    sid="coco" home="/u01/app/oracle/product/11.2.0.4/db_1" user="oracle" \
    listener="LI_COCO" tns_admin="/u01/app/oracle/product/11.2.0.4/db_1/network/admin" \
    op monitor on-fail=standby --group ora_grp
  5. Create Oracle Database resource.

    pcs resource create coco_inst oracle \
    sid="coco" home="/u01/app/oracle/product/11.2.0.4/db_1" user="oracle" shutdown_method=immediate \
    op monitor on-fail=standby --group ora_grp

Create lsb resource for oracle database

pcs resource create ora_orcl lsb:lsb_ora_orcl --group oraclegroup
pcs resource update ora_orcl op start timeout=30
pcs resource update ora_orcl op stop timeout=30

Reference:

Corosync/Pacemaker - LSB Resources Restart When Starting Node (Doc ID 2925231.1)
/etc/init.d/lsb_ora_orcl