MACH 11 - Overview

Please read the MACH 11 Overview section which contains links to useful information around the technology. Additionally it contains some general information about the MACH 11 Cluster whose setup is described in this Wiki as well as some links to popular virtualization software which allows you to create several virtual hosts on a single physical machine.

HDR - High Availability Data Replication

The HDR technology has been introduced by INFORMIX in version 6.0 of the data server back in 1993. It is a mature technology that allows the replication of a complete instance (including all logged databases) to a standby instance. The 2nd instance runs in readonly mode and can be used to offload reporting and complex SQL queries from the primary instance. Starting with IDS V11.5, write access is also supported on the HDR instance. In case of a failure of the primary instance, the standby instance can take over the work of the primary.

HDR is application neutral and is easy to configure and maintain. In the following article we will safeguard our penguin instance with a HDR secondary instance named penguin_hdr.

HDR requires that you use the same hardware and operating systems on both boxes. Marginal differences regarding the OS patchlevel or the installed processors and memory are possible, but you should keep both instances as similar as possible. Remember that the goal of HDR is to achieve high availability, so it wouldn't make much sense to put fewer processors and memory in your 2nd box as this would be counterproductive as soon as you need to switch to the 2nd box because your primary box went down.

Also the IDS version has to be exactly the same on both systems. If you have the requirement to work with different IDS versions in an heterogeneous environment, consider the use of ER (Enterprise Replication).

HDR requires that exactly the same chunk pathnames are used on both machines. If you plan to setup the HDR instance on the same machine, which is only recommended for testing purposes , you need to work with relative chunk pathnames as described in the following blog entry from IDS architect Madison Pruet:

The following instruction guidelines assume that the HDR instance is created on a dedicated machine (apollo_hdr), distinct from the machine (apollo) that runs the penguin instance. The configuration will be performed as user informix unless otherwise noted.

1. Directory Structure

  • export PENGUIN_HDR=/home/informix/instances/penguin_hdr
  • mkdir -p $PENGUIN_HDR/logs
  • chmod 775 $PENGUIN_HDR/logs
  • mkdir -p $PENGUIN_HDR/data
  • chmod 775 $PENGUIN_HDR/data

2. Environment File

We will copy the environment file from our primary penguin instance and change the INFORMIXSERVER environment variable:

  • cd $PENGUIN_HDR
  • scp -p informix@apollo:/home/informix/instances/penguin/env.sh .
  •  vi env.sh
    export INFORMIXSERVER=penguin_hdr

The new environment file looks like this:

#!/bin/bash
export INFORMIXDIR=/opt/ibm/ids/ids.dev
export INFORMIXSERVER=penguin_hdr
export ONCONFIG=onconfig.$INFORMIXSERVER
export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts.$INFORMIXSERVER
export LD_LIBRARY_PATH=$LD_IBRARY_PATH:$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql
export PATH=$PATH:$INFORMIXDIR/bin
export PENGUIN_HDR=/home/informix/instances/$INFORMIXSERVER

After modifying the file we should execute it in the current shell in order to set the necessary environment for our IDS instance:

  • . $PENGUIN_HDR/env.sh

Remember to use the leading dot, so that the environment variables are set in the current shell.

You might check if everything has been set correctly using the env comand:

  • env | egrep "^INFORMIX|^ONCONFIG|^LD_LIBRARY_PATH|^PATH|^PENGUIN_HDR"

3. Communication File

We will create a new sqlhosts file that contains an entry for our HDR instance and another entry pointing to our primary instance penguin:

  • HDR Secondary (Instance penguin_hdr, Machine apollo_hdr)
    • vi $INFORMIXSQLHOSTS
      #=================================================
      #DBSERVER      PROTOCOL      HOSTNAME      SERVICE
      #=================================================
      penguin_hdr    onsoctcp      apollo_hdr     40200
      penguin        onsoctcp      apollo       40000
      

In addition we need to add the new instance penguin_hdr to the already existing sqlhosts file of the primary instance penguin on machine apollo:

  • HDR Primary (Instance penguin, Machine apollo)
    • vi $INFORMIXSQLHOSTS
      #=================================================
      #DBSERVER      PROTOCOL      HOSTNAME      SERVICE
      #=================================================
      penguin        onsoctcp      apollo       40000
      penguin_drda   drsoctpc      apollo       40001
      penguin_shm    onipcshm      apollo       dummy
      # new entry pointing to the HDR instance
      penguin_hdr    onsoctcp      apollo_hdr     40200
      

Please do not copy/paste the sqlhosts files above. This might lead to problems due to hidden control characters. Just write it off from the above examples.

4. Configuration File

In the next step we will create a dedicated onconfig file for our penguin_hdr instance. We use the existing onconfig.penguin as a template for onconfig.penguin_hdr:

Copy Configuration File

  • cd $INFORMIXDIR/etc
  • scp informix@apollo:/opt/ibm/ids/ids.dev/etc/onconfig.penguin $ONCONFIG

Adjust Parameters in Configuration File

  • vi $INFORMIXDIR/etc/$ONCONFIG

Generic Parameters

  • MSGPATH
    • MSGPATH  /home/informix/instances/penguin_hdr/logs/online.log
  • SERVERNUM
    • Our PRIMARY instance penguin has SERVERNUM 1 assigned, the SDS instance penguin_sds1 has SERVERNUM 2 assigned. IDS server numbers must be unique on the same machine, but are allowed to overlap if the instances are located on different machines. Anyway, we will choose the unique approach:
    • SERVERNUM  3
  • DBSERVERNAME
    • DBSERVERNAME     penguin_hdr
  • DBSERVERALIASES
    • We will create no aliases for our penguin_hdr, so leave this parameter blank.
    • DBSERVERALIASES
  • DUMPDIR
    • DUMPDIR  /home/informix/instances/penguin_hdr/logs

HDR Specific Parameters

Please set the HDR parameters on both sides (PRIMARY instance penguin and HDR secondary instance penguin_hdr) according to the following list:

  • DRTIMEOUT
    • Timeout for HDR Operations in seconds
    • 10
  • DRINTERVAL
    • Interval for transferring Data Replication Buffer (-1=Synchron)
    • 5
  • DRLOSTFOUND
    • Full pathname for lost transactions file
    • /home/informix/instances/penguin_hdr/logs/dr.lostfound
  • DRIDXAUTO
    • Automatic Transfer of corrupted indexes to HDR instance (0=disabled, 1=enabled)
      • 0
  • ENCRYPT_HDR
    • Encrypt messages between Primary and HDR Secondary instance (0=disabled, 1=enabled)
      • 0
  • DRAUTO
    • Specifies behaviour if Primary went down and comes back again (0=disabled, 1=RETAIN_TYPE, 2=REVERSE_TYPE, 3=CM_ARBITRATOR)
      • 0

A detailed description of the above mentioned HDR parameters can be found here:

5. Trust Instances

You need to trust user informix on the HDR primary and secondary site. This could either be done thru the traditional Unix etc/hosts.equiv or .rhosts mechanism or thru a new Informix based mechanism. We will use the .rhosts mechanism here:

Unix .rhosts Mechanism

  • HDR Primary, Instance penguin, Machine apollo
    • vi ~informix/.rhosts
    • apollo_hdr  informix
  • HDR Secondary, Instance penguin_hdr, Machine apollo_hdr
    • vi ~informix/.rhosts
    • apollo  informix

Verify that trusting works by making sure that executing the following commands as user informix don't prompt for a password:

  • Machine apollo
    • rsh apollo_hdr date
  • Machine apollo_hdr
    • rsh apollo date

6. Backup HDR Primary

We need to create a backup of your HDR Primary which will serve as base for the initial synchronization between Primary and Secondary:

  • Perform Level-0-Backup on HDR Primary (Instance penugin, Machine apollo)
    • ontape -s -L 0 -t STDIO | gzip > /tmp/ontape.L0.penguin.gz
  • Transfer the backup image from HDR Primary to HDR Secondary (Instance penguin, Machine apollo)
    • scp /tmp/ontape.L0.penguin.gz informix@apollo_hdr:/tmp

7. Restore HDR Secondary

The backup from the HDR Primary must be restored on the HDR Secondary:

  • Before starting the Restore, you need to create the same chunk layout on the HDR Secondary as

on the HDR Primary

  • for CHK in (rootdbs1.chk datadbs1.chk1  idxdbs1.chk1  logdbs.chk1  physdbs.chk1 tempdbs1.chk1)
    do
       touch $PENGUIN_HDR/data/$CHK
       chmod 660 $PENGUIN_HDR/data/$CHK
    done
    
    • Because the chunk pathnames need to be exactly the same as on the HDR primary, we will create a symbolic link. This ensures that IDS can address the chunks on machine apollo_hdr thru the same pathname as on machine apollo:
      • ln -s $PENGUIN_HDR /home/informix/instances/penguin
  • Restore backup image on HDR secondary (Instance penguin_hdr, Machine apollo_hdr)
    • gzip -d -c /tmp/ontape.L0.penguin.gz | ontape -p -t STDIO

8. Initialize HDR Connection

The HDR connection could be established with two simple commands:

  • On the HDR Primary (Instance penguin, Machine apollo) we need to declare it as

Primary as well as announcing the name of the HDR Secondary

  • onmode -d primary penguin_hdr
  • On the HDR Secondary (Instance penguin_hdr, Machine apollo_hdr) we need to declare it as

Secondary as well as announcing the name of the HDR Primary

  • onmode -d secondary penguin

After these commands HDR Primary and Secondary will talk to each other and the Primary sends all transactions, that have been processed since the Level-0-Backup, to the Secondary. The Secondary rollforwards them until both instances are synchronized. Just continuously watch the online.log on the Secondary:

  • tail -f $PENGUIN_HDR/logs/online.log &

On the HDR Secondary, you will see some similar messages like the following in your online.log:

16:50:46  DR: new type = secondary, primary server name = penguin
16:50:46  DR: Owner of the disk is set as penguin_hdr.
16:50:46  DR: Trying to connect to primary server = penguin
16:50:49  DR: Secondary server connected
16:50:50  DR: Secondary server needs failure recovery
16:50:50  DR: Failure recovery from disk in progress ...
16:50:50  Logical Recovery Started.
16:50:50  10 recovery worker threads will be started.
16:50:51  Start Logical Recovery - Start Log 3, End Log ?
16:50:51  Starting Log Position - 3 0x521044
16:50:51  Clearing the physical and logical logs has started
16:50:51  shmctl: errno = 12
16:51:08  Cleared 255 MB of the physical and logical logs in 17 seconds
16:51:12  Started processing open transactions on secondary during startup
16:51:12  Finished processing open transactions on secondary during startup.
16:51:13  Checkpoint Completed:  duration was 0 seconds.
16:51:13  Fri Aug  1 - loguniq 3, logpos 0x525018, timestamp: 0x2d18d Interval: 90
16:51:13  Maximum server connections 0
16:51:13  Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 0, Plog used 12, Llog used 0
16:51:16  Logical Log 3 Complete, timestamp: 0x2f0ff.
16:51:18  Btree scanners disabled.
16:51:19  DR: HDR secondary server operational

On the HDR Primary, you will see some similar messages like the following in your online.log:

16:50:50  DR: Primary server connected
16:50:50  DR: Secondary server needs failure recovery
16:51:10  Logical Log 3 Complete, timestamp: 0x2ec0d.
16:51:10  DR: Sending log 3, size 5000 pages, 33.80 percent used
16:51:12  DR: Sending log 4 (current), size 5000 pages, 0.06 percent used
16:51:17  DR: Sending Logical Logs Completed
16:51:18  DR: Primary server operational

That's it. Your HDR server pair is up and running !

9. Monitoring HDR

You can monitor the status of your HDR server pair with a single simple command:

  • onstat -g dri
    • on the HDR Primary, you will see something like this:
      IBM Informix Dynamic Server Version 11.50.FC1DE -- On-Line (Prim) -- Up 1 days 00:04:51 -- 157380 Kbytes
      
      Data Replication:
        Type           State        Paired server        Last DR CKPT (id/pg)    Supports Proxy Writes
        primary        on           penguin_hdr                   4 / 9          NA
      
        DRINTERVAL   5
        DRTIMEOUT    10
        DRAUTO       0
        DRLOSTFOUND  /home/informix/instances/penguin/logs/dr.lostfound
        DRIDXAUTO    0
        ENCRYPT_HDR  0
      
    • on the HDR Secondary, you will see something like this:
      IBM Informix Dynamic Server Version 11.50.FC1DE -- Read-Only (Sec) -- Up 00:41:57 -- 173764 Kbytes
      
      Data Replication:
        Type           State        Paired server        Last DR CKPT (id/pg)    Supports Proxy Writes
        HDR Secondary  on           penguin                       4 / 9          N
      
        DRINTERVAL   5
        DRTIMEOUT    10
        DRAUTO       0
        DRLOSTFOUND  /home/informix/instances/penguin_hdr/logs/dr.lostfound
        DRIDXAUTO    0
        ENCRYPT_HDR  0
      
    • The onstat -g dri command shows you:
      • the Type of the server
        • 'HDR Primary' or 'HDR Secondary' or 'Standard'
      • the State of HDR
        • 'on' or 'off'
      • the name of the Paired Server
      • the last checkpoint id and page - Last DR CKPT (id/pg)
      • if a secondary server is updateable (Supports Proxy Writes):
        • Y (Yes), N (No) or N/A (Not Available - for example if this is already a Primary Server)
      • the values of all HDR related onconfig parameters

Further Information

From here you might move on to:

 
idsdev/ha/hdr.txt · Last modified: 2008/09/01 15:02 by eherber     Back to top