Defining sqlhosts information for connection management of server sets

You must define sqlhosts network-connectivity information for connection management of server sets.

About this task

The Connection Manager's sqlhosts file must contain entries for all database servers that it connects to.

To use a file other than $INFORMIXDIR/etc/sqlhosts on a specific host, set the host's INFORMIXSQLHOSTS environment variable to the alternative file.

Procedure

  1. On the host of each Connection Manager and database server, create sqlhosts file entries for each database server.
    For example:
    #dbservername   nettype    hostname   servicename   options
     standalone_1   onsoctcp   host_1     port_1
    
     standalone_2   onsoctcp   host_2     port_2
    
     standalone_3   onsoctcp   host_3     port_3
  2. On the host of each client application, create an sqlhosts file entry for each service-level agreement (SLA) in each Connection Manager configuration file.
    The first Connection Manager's configuration file has the following entries:
    NAME connection_manager_1
    MACRO servers=standalone_1,standalone_2,standalone_3
    
    SERVERSET ${servers}
    {
       INFORMIXSERVER ${servers}
       SLA sla_1a DBSERVERS=standalone_1
       SLA sla_2a DBSERVERS=standalone_2
       SLA sla_3a DBSERVERS=standalone_3
    }
    The second Connection Manager's configuration file has the following entries:
    NAME connection_manager_2
    MACRO servers=standalone_1,standalone_2,standalone_3
    
    SERVERSET ${servers}
    {
       INFORMIXSERVER ${servers}
       SLA sla_1b DBSERVERS=standalone_1
       SLA sla_2b DBSERVERS=standalone_2
       SLA sla_3b DBSERVERS=standalone_3
    }
    Add the following entries to each client application's host sqlhosts file:
    #dbservername  nettype   hostname   servicename  options
     sla_1a        onsoctcp  cm_host_1  cm_port_1
     sla_1b        onsoctcp  cm_host_2  cm_port_2
    
     sla_2a        onsoctcp  cm_host_1  cm_port_3
     sla_2b        onsoctcp  cm_host_2  cm_port_4
    
     sla_3a        onsoctcp  cm_host_1  cm_port_5
     sla_3b        onsoctcp  cm_host_2  cm_port_6
    
  3. On the host of each client application, create sqlhosts file group entries for each group of SLA entries, and add group options to the SLA entries. Use the c=1 group-entry option so that connection-attempt starting points in the list of group members is random. Use the e=last_member group-entry option so that the entire sqlhosts is not scanned for group members.
    For example:
    #dbservername  nettype   hostname   servicename  options
     sla_1         group     -          -            c=1,e=sla_1b
     sla_1a        onsoctcp  cm_host_1  cm_port_1    g=sla_1
     sla_1b        onsoctcp  cm_host_2  cm_port_2    g=sla_1
    
     sla_2         group     -          -            c=1,e=sla_2b
     sla_2a        onsoctcp  cm_host_1  cm_port_3    g=sla_2
     sla_2b        onsoctcp  cm_host_2  cm_port_4    g=sla_2
    
     sla_3         group     -          -            c=1,e=sla_3b
     sla_3a        onsoctcp  cm_host_1  cm_port_5    g=sla_3
     sla_3b        onsoctcp  cm_host_2  cm_port_6    g=sla_3
    

Results

Client connection requests to @sla_1 are directed to one of the Connection Managers. If connection_manager_1 receives the request, it uses sla_1a to provide the client application with connection information for the primary server. If connection_manager_2 receives the request, it uses sla_1b to provide the client application with connection information for a replication server.