Showing posts with label Clustering. Show all posts
Showing posts with label Clustering. Show all posts

Friday, August 16, 2013

Configure CFS cluster and CFS mount point


Summary:

This LAB was a hands-on for CFS implementation/configuration. CFS cluster will be configured and one mount point will be added.

Prerequisites:

Before you starting configuring VERITAS CFS cluster and start adding new CFS mount point for active-active disk usage; make sure you have:
  1. SF installed with right set of license keys
  2. You have configured VCS on all participant servers (in my case I have two servers guest1 and guest3 with RHEL 5)
  3. You have checked cluster status with "/opt/VRTSvcs/bin/hastatus –summary"
  4. Make sure you virtual IP is accessible
  5. Make sure you have disks presented on cluster participants/nodes. Storage is shared. Just for reference I used iSCSI storage.
  6. Take note of the disks those you have plans to configure in CFS cluster.
  7. Take note of the mount point and volume names.

Cluster Configuration

Following are the steps to configure CFS cluster on both LAB Servers (guest1 and guest3).
  1. Run "/opt/VRTSvxfs/cfs/bin/cfscluster status" to check if CFS is not already configured
    1. "[root@guest3 bin]# /opt/VRTSvxfs/cfs/bin/cfscluster status
    NODE CLUSTER MANAGER STATE CVM STATE
    guest1 running         not-running
    guest3 running         not-running

     
    Error: V-35-41: Cluster not configured for data sharing application
  2. Check cluster status by running "/opt/VRTSvcs/bin/hastatus -summary" and make sure cluster nodes are online.
    1. /opt/VRTSvcs/bin/hastatus –summary
      -- SYSTEM STATE
      -- System State Frozen

       

      A guest1 RUNNING 0
      A guest3 RUNNING 0

       

      -- GROUP STATE
      -- Group System Probed AutoDisabled State

       

      B ClusterService guest1 Y N ONLINE
      B ClusterService guest3 Y N OFFLINE

 

  1. Run "/opt/VRTSvxfs/cfs/bin/cfscluster config" to configure the CFS cluster services (cluster VERITAS volume manager)
    1. Let the configuration complete
  2. Check the CFS cluster services status with "/opt/VRTSvxfs/cfs/bin/cfscluster status"

     

    [root@guest3 bin]# /opt/VRTSvxfs/cfs/bin/cfscluster status


     

    Node         : guest1
    Cluster Manager     : running
    CVM state         : running
    No mount point registered with cluster configuration

     


     

    Node         : guest3
    Cluster Manager     : running
    CVM state         : running
    No mount point registered with cluster configuration
  3. Check which node is master with "vxdctl –c mode"
    [root@guest3 bin]# vxdctl -c mode
    mode: enabled: cluster active - SLAVE
    master: guest1

     

    In my case I am shifting my console to guest1 and will be adding new disks and mount points from there.
    [root@guest1 bin]# vxdctl -c mode
    mode: enabled: cluster active - MASTER
    master: guest1
  4. Check the available disks with "vxdisk list"
  5. Initialize the disk with "/opt/VRTS/bin/vxdisksetup –i disk_2" #in my case its disk_2 that initialize. It could be different from system to system on the bases of SAN.
  6. Verify that disk is initialized with "vxdisk list" – here is expected outcome "disk_2 auto:cdsdisk - - online"
  7. Add new disk group with "vxdg –s init cfsdg disk01=disk_2". Here cfsdg is the name of new disk group with disk_2 added as disk01 and –s is used to make it a shared DG.
  8. Verify the disk group with "vxdg list cfsdg"
  9. Verify the same from "vxprint –hrt output".
    [root@guest1 bin]# vxprint -hrt

    Disk group: cfsdg

     

    DG NAME NCONFIG NLOG MINORS GROUP-ID
    ST NAME STATE DM_CNT SPARE_CNT APPVOL_CNT
    DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE
    RV NAME RLINK_CNT KSTATE STATE PRIMARY DATAVOLS SRL
    RL NAME RVG KSTATE STATE REM_HOST REM_DG REM_RLNK
    CO NAME CACHEVOL KSTATE STATE
    VT NAME RVG KSTATE STATE NVOLUME
    V NAME RVG/VSET/CO KSTATE STATE LENGTH READPOL PREFPLEX UTYPE
    PL NAME VOLUME KSTATE STATE LENGTH LAYOUT NCOL/WID MODE
    SD NAME PLEX DISK DISKOFFS LENGTH [COL/]OFF DEVICE MODE
    SV NAME PLEX VOLNAME NVOLLAYR LENGTH [COL/]OFF AM/NM MODE
    SC NAME PLEX CACHE DISKOFFS LENGTH [COL/]OFF DEVICE MODE
    DC NAME PARENTVOL LOGVOL
    SP NAME SNAPVOL DCO
    EX NAME ASSOC VC PERMS MODE STATE
    SR NAME KSTATE

     

    dg cfsdg default default 9000 1376650536.16.guest1

     

    dm disk01 disk_2 auto 65536 2017024 -

    Note:
    Veritas volume manager reports available disk space in 512 byte blocks. There we have 2017024 blocks which calculates to about 985MB of space. #Hope math is easy J
  10. Create volume using "vxassist -g cfsdg make cfsvol 984M" and verify volume creation from "vxprint –hrt". Check for the line
    "sd disk01-01 cfsvol-01 disk01 0 2015232 0 disk_2 ENA"
  11. Create file system on new volume using
    "mkfs -t vxfs /dev/vx/rdsk/cfsdg/cfsvol" make sure you use right FStype switch and it varies across UNIX platforms
  12. Make new shared DG part of CFS using
    "/opt/VRTS/bin/cfsdgadm add cfsdg all=sw"
    Disk Group is being added to cluster configuration...
  13. Verify the above with
    [root@guest1 bin]# /opt/VRTS/bin/cfsdgadm display cfsdg

    NODE NAME ACTIVATION MODE
    guest1 sw
    guest3 sw
  14. Next is to add this volumes/filesystems to the cluster configuration so they can be mounted on any or all nodes. Mount points will be automatically created
    [root@guest1 bin]# /opt/VRTS/bin/cfsmntadm add cfsdg cfsvol /cfs all=cluster

    Mount Point is being added...
    /cfs added to the cluster-configuration
  15. Verify the newly added mount point with
    [root@guest1 bin]# /opt/VRTS/bin/cfscluster status


     

    Node : guest1
    Cluster Manager     : running
    CVM state         : running
    MOUNT POINT SHARED VOLUME DISK GROUP STATUS
    /cfs cfsvol cfsdg NOT MOUNTED

     


     

    Node : guest3
    Cluster Manager     : running
    CVM state         : running
    MOUNT POINT SHARED VOLUME DISK GROUP STATUS

    /cfs cfsvol cfsdg NOT MOUNTED
  16. Mount newly added mount point on both cluster nodes using
    [root@guest1 bin]# /opt/VRTS/bin/cfsmount all

    Mounting...
    [/dev/vx/dsk/cfsdg/cfsvol] mounted successfully at /cfs on guest1
    Mounting...
    [/dev/vx/dsk/cfsdg/cfsvol] mounted successfully at /cfs on guest3
  17. Check cfscluster status
    [root@guest1 bin]# /opt/VRTS/bin/cfscluster status

     

    Node : guest1
    Cluster Manager : running
    CVM state : running
    MOUNT POINT SHARED VOLUME DISK GROUP STATUS

    /cfs cfsvol cfsdg MOUNTED


     


     

    Node : guest3
    Cluster Manager : running
    CVM state : running
    MOUNT POINT SHARED VOLUME DISK GROUP STATUS

    /cfs cfsvol cfsdg MOUNTED
  18. Verify local mounts as
    #df –h
    /dev/vx/dsk/cfsdg/cfsvol
    984M 36M 890M 4% /cfs

     


     

    Congratulations! CFS cluster and CFS file system is configured and ready to for Active-Active usage (on both nodes in my case).

Wednesday, June 26, 2013

Linux 6 HA setup with Oracle

Note: 1) Blog is intended for people with good knowledge of Linux as OS and shell as a tool.
          2) Steps are extracted from RHEL 6.x HA implementation
Like every HA/clustering technology, making any service (DB,NFS,web server or any custom script) is accomplished by going through
1-     Configuring two servers in cluster / Preparing the machine/servers to look for each other
2-     Configuring the required service to fail over in event of some hardware/network failure.

####################      1      #####################
For Linux, list of per-requisites is given as:
i.          Backup existing /etc/yum.repos.d/rhel-source.repo file, and edit this file as shown below.
[rhel-local-base] 
gpgcheck=1 
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///mnt 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-local-HA] 
gpgcheck=1 
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///mnt/HighAvailability 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-local] 
gpgcheck=1 
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///mnt/LoadBalancer 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-local-RS] 
gpgcheck=1 
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///mnt/ResilientStorage 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-local-SF] 
gpgcheck=1 
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///mnt/ScalableFileSystem 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-local-Server] 
gpgcheck=1 
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///mnt/Server 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release  

and run
       
rpm –import <location_on_DVD>/RPM-GPG-KEY-redhat-release 

  
I assumed that you have DVD (Linux 6x in my case) in DVD drive.

  ii-       Install following software
    a.    cman
    b.    rmanager
    c.    luci
    d.    ricci
    e.    GFS
    f.    clvmd


OR

Alternatively you can use

#yum groupinstall "HighAvailability"
#yum groupinstall "LoadBalancer"
#yum groupinstall "ResilientStorage"
#yum groupinstall "ScalableFileSystem"

Remember to restart yum after adding above repos.

iii-    you must have 5 IPs and 4 NIC interfaces available for the systems.

iv-    Next is to configure services
       a) disable and turn off iptables with #chkconfig iptables off and #service iptables stop
       b) disable and turn off selinux with #chkconfig selinux off and #service selinux stop
       c) enable and run luci with #chkconfig luci on and #service luci start
       d) enable and run ricci with #chkconfig ricci on and #service ricci start
       e) enable and run rmanager with #chkconfig rmanager on and #service rmanager start
       f) enable and run clvmd with #chkconfig clvmd on and #service clvmd start

Note: After luci is started, it should be accessible with https://hostname_or_IP:8084. Sample is given as:


v-    Reset luci's password - in case!

vi-    Next step is create fence - in my case i have used HP's iLO as a fence. following url can help you configure the fence.
http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&lc=en&dlc=en&docname=c03138211

Use luci's GUI to create fence rather editing cluster configuration as presented in HP's link.

vii-    System's /etc/hosts should look like below and NICs on both hosts should be configured accordingly.
                   
192.168.0.1   labnode1
192.168.0.2   labnode2
192.168.0.3   service_VIP
192.168.0.4   labnode1_hb
192.168.0.5   labnode2_hb


viii-    Run and configure cman for start as
            #chkconfig cman on; service cman start

after this onward, both systems are ready to be configured/bundled in a cluster - you name it.

ix-    login luci and add nodes and then create cluster
on shell #clustat command can acknowledge the cluster status. systems are ready to be configured to run your service (in this case Oracle) in HA configuration.

Note: when adding nodes in luci, use labnode1_hb and labnode2_hb as your cluster node names.  
        You put heartbeat link node name. This is how REHL HA uses heartbeat link to check each 
        other’s health, therefore determine whether fencing each other in case of the other node 
        fails to responds



################    2     #################

For any service to be configured in cluster with HA/LB functionality, one should understand / have the followings:

    a.    Virtual IP / Virtual host name for service
    b.    Some shared storage with clvmd or GFS
    c.    Way to start the application - could be some predefined template in cluster tool or your
           customer script
    d.    Way to stop the application - could be some predefined template in cluster tool or your
           customer script
    e.    How and what you want to monitor for service fail-over

in my case, VIP/Virtual_hostname is already configured in /etc/hosts. i have /u01 and /u02 as a choice for shared storage, i'll be using predefined Oracle option in luci to create HA instance of oracle with listener. Monitoring and start/stop will be handled by the same.

In Linux a service that is going to be configured is on top of a cluster and fail-over domain. service is called a "service group" and above mentioned things are called service group "resources". From one tool to the other, you may find different names. For example in service guard, a service group is called a package and all the resources are pre-reqs to build a package. in VERITAS SF, name differs slightly - but concept remains the same. i.e.

you should have one cluster - then one fail-over domain (not present in HP or VERITAS etc.) then a service group running on top of that fail-over domain with certain resources (IP, shared storage, start/stop scripts and monitoring).
With sufficient knowledge you can translate above in HP's, SUN's (now oracle) or VERITAS version.

Lets configure oracle as HA service in Redhat cluster services; configured above.

i-    Verify you have your /etc/hosts has VIP entry (already done when configuring NIC interfaces.)
ii-   Three slices have been presented to both the servers. Two disks are shared for DB data and
       quorum disk and one for oracle binary installation. you may put oracle binaries on some shared
       storage to avoid installation on secondary nodes but you 'll have configure oracle user and home
       directories accordingly.

Create storage as:



1.     # pvcreate /dev/mapper/dm-1
2.     # vgcreate -cy vgdata/dev/mapper/dm-1
3.     # lvcreate -L 10G -n lvdata vgdata
4.     # mkfs.ext4 /dev/vgdata/lvdata
5.     # vgchange -an vgdata 
6.     # pvcreate /dev/mapper/dm-2 
7.     # vgcreate  vgapp/dev/mapper/dm-2 #Note for local -cy is missing
8.     # lvcreate -L 10G -n lvapp vgapp 
9.     # mkfs.ext4 /dev/vgapp/lvapp
10.  # vgchange -an vgapp 
11.   # pvcreate /dev/mapper/dm-3
12.  # vgcreate -cy vgqrm/dev/mapper/dm-3 
13.  # lvcreate -L 2G -n lvqrm vgqrm
14.   # mkfs.ext4 /dev/vgqrm/lvqrm
      15.  # vgchange -an vgqrm



         Create mount points on root as #mkdir /u02
iii-    Access luci GUI add a failover domain - in my case its OracleHA. Failover domain is may not
         be prioritized or restricted.  
iv-    Access the resources tab in luci and starting adding resources:  
         a).   Add IP resources (service IP; the same IP that was given in /etc/hosts as VIP); in my case it
         is 192.168.0.3
         b). Add LVM HA resource. Provide resource name, and quorum disk VG name vgqrm and LV 
              name as lvqrm.
         c). Add filesystem resource. Provide resource name (database in my case), mount point (/02), 
              filesystem (ext4 in my case), LV path (/dev/vgdata/lvdata in my case) 
Note: While adding resources, keep "child resource" option in perspective. It defines order and precedence of resources added.

At this point your can submit the configuration and try starting service on either nodes. You should have VIP and /u02 available. you can check service fail-over as well.



v-    Install oracle on both nodes (on /u01 which is a local non-shared mount point). At this point,
        probably, you need to handover servers to some oracle guy to go through the OS configuration
        related to Oracle and Oracle installation.
vi-   Add Oracle resource. provide resource name and other oracle details like ORACLE_HOME and
       ORACLE_SID etc.
vii-  Add Oracle listener resource.
viii- At this point you should be able to run oracle instance on both nodes using luci GUI. If service is
       failed, refer to the cluster log files and Linux messages to know whats actually going on. Use
       clustat to verify the status of cluster and the service.