A Connection Manager provides load balancing and directs client connection requests to the appropriate server in a connection unit based on SLA.

1 Connection unit

A connection unit is a collection of database servers in a:

  • Grid
  • High-availability cluster
  • Replicate set
  • Server set

2 Service Level Agreement (SLA)

SLA is a contract between specified client applications and their service providers, in this case, Informix database servers.

Based on SLA, the Connection Manager connects the client applications to the appropriate servers. The Connection Manager accepts client connection requests and either redirects the requests to the appropriate server or functions as a proxy server between the client applications and the servers.

3 Configuration file

You use a configuration file for replicate sets when you want the Connection Manager to manage SLAs.

The default configuration file name and location is:

Copy
$INFORMIXDIR/etc/cmsm.cfg

Sample file:

Copy
LOG 1
LOGFILE /home/informix/tmp/test.log
CLUSTER cm_customer
{
   INFORMIXSERVER  cm_customer
   SLA g_customer DBSERVERS=primary \
                POLICY=WORKLOAD \
                MODE=REDIRECT
   FOC ORDER=ENABLED \
       PRIORITY=3 \
       TIMEOUT=120
}

Keywords used:

  • LOG: Specifies whether to log information about PROXY and REDIRECT modes. Set LOG=1 to log information about both PROXY and REDIRECT SLAs.
  • LOGFILE: Specifies the name and location of the Connection Manager log file. The log file is continuously updated with status information as long as the Connection Manager is running.
  • SLA
    • DBSERVERS: Specifies servers, server aliases, server groups, or server types for directing connection requests.
    • POLICY: Specifies how the Connection Manager redirects client connection requests to the servers specified in the DBSERVER attribute. The default value is WORKLOAD.
    • MODE: Specifies whether connection requests go through the Connection Manager or if the Connection Manager provides connection information to the source of a connection request. The default value is REDIRECT.
  • FOC: Specify the failover configuration for the cluster.
    • ORDER=ENABLED: Specifies that the value of the primary server's HA_FOC_ORDER configuration parameter is used for automatic failover.
    • PRIORITY: Specifies the priority of connections between Connection Managers and the primary server of the cluster. The lower the number, the higher the priority.
    • TIMEOUT: Specifies the number of additional seconds the Connection Manager waits for primary-server events before the Connection Manager begins failover processing.

4 sqlhosts

Imagine a simple scenario with 2 servers and HDR replication (primary and secondary).

Now a Connection Manager is added on the primary server to get failover.

Primary server sqlhosts file:

Copy
pcustomer           onipcshm    on_pcustomer    on_pcustomer
ol_pcustomer        onsoctcp    pcustomer       sqlexec
ol_pcustomer_ssl    onsocssl    pcustomer_hdr   sqlexec-ssl

# HDR
ol_pcustomer_hdr    onsoctcp    pcustomer_hdr   sqlexec
ol_scustomer_hdr    onsoctcp    scustomer_hdr   sqlexec

# CM
g_customer         group       -               -       c=1,e=ol_scustomer_hdr
ol_pcustomer_hdr    onsoctcp    pcustomer_hdr   sqlexec g=g_customer
ol_scustomer_hdr    onsoctcp    scustomer_hdr   sqlexec g=g_customer

cm_customer         onsoctcp    pcustomer_hdr   9087

A group called cm_customer is defined, composed by the servers: ol_pcustomer_hdr and ol_scustomer_hdr.

The name of the group is equal than the SLA name defined in the previous section

5 The oncmsm utility

The oncmsm utility is used to configure and start the Connection Manager.

To start the Connection Manager:

Copy
oncmsm

To stop the Connection Manager:

Copy
oncmsm -k <instance_name>

6 Print Connection Manager information

Use the onstat -g cmsm command to display information about a specific Connection Manager, or all of the Connection Managers that are attached to the database server the command is run on.

Copy
Unified Connection Manager: cm_customer                Hostname: pcustomer

CLUSTER         my_cluster_1      LOCAL
   SLA          Connections   Service/Protocol   Rule
   cm_customer           35     19910/onsoctcp   DBSERVERS=primary
   ol_pcustomer          33     19810/onsoctcp   DBSERVERS=(HDR,SDS,RSS)

   Failover Arbitrator: Active Arbitrator, Primary is up
   ORDER=SDS,HDR,RSS PRIORITY=3

7 Failover manual

In case of crash of the current primary server and the secondary server does not become primary automatically, you can force the change manually by executing the following instruction on the secondary server:

Copy
onmode -d make primary ol_scustomer_hdr force

8 Secondary server

The secondary server never reestablishes itself automatically, after analyzing the cause of the crash you can activate the secondary server by executing the following instructions on the server that was primary before failover:

Copy
oninit –PHY
onmode -d secondary ol_scustomer_hdr