Informix Connection Manager for MACH11 cluster -- Posted by inturi on Wednesday, June 18 2008
Connection Manager (CM):

Connection Manager (CM):

· Connection manager is a new utility written in esqlc and installed with Client SDK. Connection Manager requires that applications connecting to it be compiled with Client SDK 3.50 or the IBM Data Server Driver for JDBC and SQLJ.

· Connection manager provides connection virtualization and load-balancing functionality for client applications, and automatic failover functionality for MACH11 cluster.

· Connection manager hides MACH11 cluster complexity from applications. Applications can view MACH11 cluster as one single IDS server instance, and connect to MACH11 cluster using pre-defined set of business rules -- called Service Level Agreement (SLA) rules-- using connection manager.

· Connection manager constantly monitors all nodes in MACH11 cluster, and performs automatic failover if primary server goes down in MACH11 cluster. This automatic failover is based on Fail-Over Configuration(FOC) rules defined in connection manager configuration file.

· CM supports following application types:

Ø ESQL

Ø JDBC

Ø Informix ODBC

Ø DRDA

· Client applications must be recompiled using CSDK 3.50 or later version to take advantage of Connection manager automatic routing of client connections to MACH11 cluster and load load-balancing functionality.

· DBA can configure more than one connection manager instance to work with MACH11 cluster.

· Connection manager must be runas informix on Unix platforms and Informix admin group on Windows platform.

Connection manager Service Level agreement (SLA) rules:

You can pre-define a set of SLA rules in CM configuration file based on your business logic. Here is the format for defining SLA rules.

Unique SLA Name Business rules

Following business rules are supported:

SLA business rule

Comments

SDS

Connect to any of the available SDS nodes

HDR

Always connect to HDR secondary server

RSS

Always connect to any of the available RSS secondary servers

Primary

Always connect to primary server in MACH11 cluster

Server name

Always connect to the given server name

+ operator

Used as OR operator.

Examples:

primary+SDS

Connect to either primary or any of the SDS secondary servers

HDR+RSS

Connect to either HDR secondary or RSS nodes

Srv_sds1+srv_sds2

Connect to either srv_sds1 or srv_sds2 servers.

Connection manager failover arbitrator:

Connection manager constantly monitors all servers in MACH11 cluster.

If primary node goes down, CM can perform automatic failover of MACH11 primary server responsibility to one of the MACH11 secondary servers using pre-defined FOC rules defined in CM configuration file. Here is the format for defining FOC rules:

FOC foc_rules,timeout_values

FOC rule

Comments

SDS

Fail over to one of the available SDS nodes

HDR

Failover to HDR secondary node

RSS

Failover to one of the available RSS node

Secondary server name

Failover to give secondary server

+ operator

Used as OR operator to specify more than one failover rule.

Examples

SDS+HDR

First try failover to SDS node. If not possible then try failover to HDR secondary.

srv_sds1+HDR

First try failover to srv_sds1 server. If not possible the try failover to HDR secondary

SDS+HDR+RSS

First try failover to one of SDS node then HDR secondary then RSS secondary.

Disabled

Disables arbitrator functionality of Connection Manager.

FOC Timeout value: Once primary server goes down, connection manager waits minimum these many seconds before starting the failover process.

CM configuration file example:

   
   NAME     cm1                   #CM name
   SLA      oltp=primary+SDS      #oltp SLA definition
   SLA      report=HDR+RSS        # report SLA definition 
   FOC      SDS+HDR+RSS,10           # Failover configuration rules
   DEBUG    1                     # debug information
   LOGFILE  /tmp/oncmsm.log       # Connection manager log file

Default CM configuration file location: $INFORMIXDIR/etc/cmsm.cfg

CM SQLHOSTS file example:

myprim ontlitcp primhost prim_port #any server in MACH11 cluster

oltp ontlitcp cmhost port2 #Connection entry for oltp SLA

report ontlitcp cmhost port3 #Connection entry for report SLA

Applications SQLHOSTS file example to connect to MACH11 cluster using connection manager:

oltp ontlitcp cmhost port2 #Connection entry for oltp SLA

report ontlitcp cmhost port3 #Connection entry for report SLA

Lets add connection manager to our MACH11 cluster:

Ø Create connection manager configuration file.

For our example, we defined oltp and report SLA rules. Our FOC rule is, first try failover to SDS, then HDR secondary and then to RSS node.

   NAME     cm1                   #CM instance name
   SLA      oltp=primary+SDS      #oltp SLA definition
   SLA      report=HDR+RSS        # report SLA definition 
   FOC      SDS+HDR+RSS,10        # Failover configuration rules
   DEBUG    1                     # debug information
   LOGFILE  /tmp/oncmsm.log       # Connection manager log file
 
For simplicity, save the above configuration rules in the default  $INFORMIXDIR/etc/cmsm.cfg file.

Ø Create SQLHOSTS file for connection manager

Here is our SQLHOSTS file for our example:

myprim ontlitcp primhost prim_port #any server in MACH11 cluster

oltp ontlitcp cmhost port2 #Connection entry for oltp SLA

report ontlitcp cmhost port3 #Connection entry for report SLA

Ø Set the location of the above SQLHOSTS file in INFORMIXSQLHOSTS environment

Ø Set INFORMIXSERVER to myprim

export INFORMIXSERVER=myprim

Note: This entry can be any available server or group in MACH11 cluster. This server entry must be defined in connection manager SQLHOSTS file.

Ø Bring up connection manager

runas informix oncmsm #This command uses default connection manager configuration file in $INFORMIXDIR/etc/cmsm.cfg

On windows, you can bring up CM as a service using the command ‘oncmsm –i’.

Ø Now Connection Manager should be up and running ! Look for errors in CM log file /tmp/oncmsm.log

Ø Now lets define SQLHOSTS file for client applications.

For our example, we will use the connection manager SQLHOSTS file for client applications as well.

myprim ontlitcp primhost prim_port #any server in MACH11 cluster

oltp ontlitcp cmhost port2 #Connection entry for oltp SLA

report ontlitcp cmhost port3 #Connection entry for report SLA

Ø Now client applications can connect to one of the SLA definitions using connect statement like below:

 
connect to @oltp  /* to connect to oltp SLA */
 

Ø Connection manager SLA and FOC rules can be monitored using ‘onstat –g cmsm’ command at any of the nodes in MACH11 cluster.

$onstat -g cmsm
 
CM name  host      sla          define          foc            flag   connections
cm1      cmhost    oltp         (primary+SDS)   SDS+HDR+RSS,10     3             5
cm1      cmhost    report       (HDR+RSS)       SDS+HDR+RSS,10     3            16
 
Ø       Now if you want to shutdown connection manager run the below command

Runas informix oncmsm –k cm1 #cm1 is the CM instance name defined in CM configuration file.

[Edit] Home
If this information is helpful to you then please click here and post one simple tip that you know. Share your knowledge!