Best Practices: Getting Started With Informix Connection Manager
Best Practices: Getting Started With Informix Connection Manager
Thomas Beebe
Advanced DataTools Corporation
[email protected]
About This Talk
• Created to give an entry point for getting
going with connection manager
• Supplement the rather sparse documentation
on the topic
• Document some of the confusion I ran into
configuring this for clients
• Assistance provided from others actively
using connection manager in production
environments
2
What Is Connection Manager
3
Topology
Client Connection
Manager
Client
Group 1 Group 2
Stand
Primary Secondary
Alone
4
Setting Up Access
5
Relevant Files
• SQLHOSTS
• Specifies the groups, also controls the CM
listeners
• $INFORMIXDIR/bin/oncmsm
• Connection Manager Binary
• $INFORMIXDIR/etc/cmsm.cfg.sample
• Sample config file, there are several versions
• $CMALARMPROGRAM
• Program, defined in configs that triggers on a
failover
6
ONCONFIG Parameters
• DRAUTO – Controls failover
processing, 3 means it will rely on the
connection manager to initiate failovers.
• HA_FOC_ORDER – Default order
(HDR,RSS,SDS) to fail over servers.
7
oncmsm
• Startup:
• $INFORMIXDIR/bin/oncmsm –c $INFORMIXDIR/etc/cmsm.cfg
• Optional environmental variable $CMCONFIG
• Commands:
• oncmsm –k –c <config file>
• Shutdown
• oncmsm –r –c <config file>
• Reload with updated config file
8
Basic Example - SQLHOSTS
#Instance Config port 9088
instance1_tcp onsoctcp host_ip sqlexec
#Connection Manager Listener
report_group onsoctcp host_ip 9090
9
Basic Example – cmsm.cfg
NAME samplecsm
LOGFILE
${INFORMIXDIR}/tmp/cmsm.log
CLUSTER samplecluster {
INFORMIXSERVER instance1_tcp
SLA report_group
DBSERVERS=primary
}
10
Base CM Config Sample
NAME cm_1
LOGFILE
${INFORMIXDIR}/tmp/cmsm.log
LOG 1
CM_TIMEOUT 300
<Connection Info>
11
cmsm.cfg Parameters
• NAME – Must be unique across the cluster
• CM_TIMEOUT – Number of seconds to wait for a response before promoting the next
highest ranked connection manager. (60 default)
• SQLHOSTS – If it should use a local, remote or both SQLhosts files to find instances.
(Default local + remote)
• LOCAL_IP – Optional, can be used to tie CM to a specific IP address to listen for database
status changes
14
Cluster Example
CLUSTER cluster_1 – Unique name of cluster, needs to be identical on
other connection managers
{
INFORMIXSERVER repl1_tcp -- The sqlhost entry (group or server) the
connection manager will listen on
SLA report_1 \ -- the SLA is for the report_1 group in sqlhosts
DBSERVERS=(PRI,HDR) \ -- This is the order it will
maintain
POLICY=WORKLOAD – This is the type of SLA policy it users
FOC ORDER=ENABLED \ -- Says to use the failover order above
PRIORITY=1 – Says this connection manager is the first
one to handle failover for this SLA
CMALARMPROGRAM $INFORMIXDIR/etc/CMALARMPROGRAM.sh –
If failover fails after 8 attempts it calls this program.
}
15
INFORMIXSERVER
• Works with all 4 types of connection
• Specify the group of servers or
standalone server this SLA should
service
• This is what the connection manager
will connect to when it comes up to
establish the replication status
16
SLA
• Service Level Agreement
• This is the directive of how a connection
manager should treat a particular group
of servers
• Any linked connection mangers should
have similar settings and the same
name for a group
• Each SLA will have its own listener port
17
SLA - DBSERVERS
• List of servers to connect to, and the
order to connect to them in
• Can use server names, group names,
server aliases, server types (HDR, SDS,
ANY)
18
DBSERVERS - Cluster
Keywords
• PRI, PRIMARY
• HDR – Secondary
• SDS – Shared disk secondary
• RSS
• ANY
19
SLA - MODE
• Redirect – (Default) this will redirect the
client directly to the server, only works with
versions later then CSDK 3.0 and JDBC
3.5.1
• PROXY – Will pass all data through the
connection manager directly, allows for
older clients to be supported. Also use this
if the client cannot directly access the
Informix server.
20
Topology - Redirect
Client Connection
Manager
Client
Group 1 Group 2
Stand
Primary Secondary
Alone
21
Topology - PROXY
Client Connection
Manager
Client
Group 1 Group 2
Stand
Primary Secondary
Alone
22
SLA - USEALIASES
• On – Default, this will add any entries in
DBSERVERALIASES into the mix.
• OFF – Only will use DBSERVERNAME
none of the aliases
23
SLA - WORKERS
• Numerical Value – Default is 4.
• Used to define how many worker
threads the CM is allocated
24
SLA - POLICY
• WORKLOAD – (Default) – Assigns the work to the least busy server
at the time
25
FOC
• Is used as a stand alone element inside
a connection type to define how failover
occurs
• Also used to specify the priority
between servers
26
FOC - ORDER
• If not defined, the primary server’s
HA_FOC_ORDER parameter is used
• Default if neither are set is SDS, HDR,
RSS
• If enabled it will use the order defined
by the DBSERVERS in the SLA
• ENABLED – Means the connection
manager will allow failover
27
FOC - PRIORITY
• Defines the priority between connection
managers.
• Must be a positive number, the lower
the number the higher the priority
• Required for CLUSTER types
28
FOC - TIMEOUT
• Additional time before a failover occurs
• Adds to the value of EVENT_TIMEOUT
• Defaults to 0
29
SQLHOSTS
30
Sample Config
Name Of This Connection Manager
NAME connection_manager_1
LOG 1
LOGFILE $INFORMIXDIR/tmp/my_cm1_log.log
EVENT_TIMEOUT 20
Cluster Name, Shared Among Connection Managers
CLUSTER primary_cluster
{ Informix Group/Server To connect to
INFORMIXSERVER cluster1
SLA report_1 DBSERVERS=(PRI,HDR) \
POLICY=WORKLOAD Connection Manager Listener
FOC ORDER=ENABLED \
PRIORITY=1
}
31
SQLHOSTS - Example
#HDR Pair of Servers
cluster_1 group - - c=1,e=repl2_tcp
repl1_tcp onsoctcp server1 9088 g=cluster_1
repl2_tcp onsoctcp server2 9088 g=cluster_1
32
Application Set Up
SQLHOSTS:
report group - -
c=1,e=report_2
report_1 onsoctcp server1 10088
g=report
report_2 onsoctcp server2 10088
g=report
33
Oncmsm Log - Startup
22:45:41 listener report initializing
22:45:41 listener report_rr initializing
22:45:41 listener current_rss initializing
22:45:41 listener proxy_rss initializing
22:45:41 Listener report_rr DBSERVERS=(HDR,RSS) POLICY=ROUNDROBIN is active with 4
worker threads
22:45:41 Listener current_rss DBSERVERS=RSS
POLICY=SECAPPLYBACKLOG:5500+WORKLOAD is active with 4 worker threads
22:45:41 Listener report DBSERVERS=(HDR,RSS) POLICY=WORKLOAD is active with 4
worker threads
22:45:41 Listener primary_cm DBSERVERS=primary is active with 4 worker threads
22:45:41 Listener proxy_rss DBSERVERS=RSS POLICY=WORKLOAD MODE=PROXY is
active with 4 worker threads
22:45:42 Connection Manager successfully connected to maytcp
22:45:42 The server type of cluster aos_cluster server furytcp is Primary.
22:45:48 The server type of cluster aos_cluster server fury is Primary.
22:46:04 Connection Manager started successfully
34
Oncmsm Log – Startup Cont
35
Oncmsm log - Connections
23:04:23 SLA report_rr redirect SQLI client from
10.10.20.60 to maytcp may.10088
23:30:25 SLA report_rr redirect SQLI client from
10.10.20.71 to furynosql fury.10098
23:30:25 SLA primary_cm redirect SQLI client from
10.10.20.63 to furynosql fury.10098
36
onstat –g cmsm
• Onstat –g cmsm
• Onconfig params
37
Best Practices
• Use groups rather then individual servers
• Run more than one connection manager
• Make sure the connection managers are on
different servers from the instances.
• If running PROXY mode make sure to have the
resources on the CM to handle the data.
• Make sure to set up applications to the use the
group of connection managers, or at least failover.
• Make sure applications reconnect with at least a
short delay.
38
Things To Be Cautious Of
• Split Brain
• Listeners missing info
• Alias issues
• Missing Trusted status
• Make sure DBSERVERNAME is the
TCP Port
39
Split Brain
• Two Primary Servers on the same network
• Need to restore one of the servers and re-establish
HDR
• Reduce the chance of this situation by having a
reliable network connection
• Can use the Connection Manager Alarm Program
to shutdown the Primary server if the Secondary
cannot be reached AND can’t get to the network –
See article on IBM developerWorks:
https://www.ibm.com/developerworks/community/blogs/informix_admins_blog/e
ntry/preventing_hdr_split_brain_scenaro
40
Auto Failover and Network Loss
Connection
• What if the PRIMARY server loses Manager
Connection
• When network connectivity is Manager
41
Listeners Missing Info
• Will get a -930 error
• Can be caused due to missing entries
from sqlhosts on the connection
manager server
• Can also get errors if the port is in use,
each SLA needs a unique port
42
Alias Issues
• By default will probe all of the systems in
the cluster for DBSERVERALIASES
values
• Can be disabled by USEALIASES
• If it sees tcp connections that appear valid
but cannot be reached by client, such as a
private replication interface, it will still try to
offer them for REDIRECT connections
43
Missing Trusted Sources
• If one of your servers does not trust the
connection manager server it will not be
able to connect successfully.
• This can be resolved by using the
password management process.
44
Encrypted Password
• Set up a file defining the servers and
what passwords to use
• Use onpassword to encrypt the file
• Stored as
$INFORMIXDIR/etc/passwd_file
• Uses a key to encrypt/decrypt to make
changes in the future
45
More Resources
• Connection Manager Manual Examples
https://www.ibm.com/support/knowledgecenter/SSGU8G_12.1.0/co
m.ibm.admin.doc/ids_admin_1437.htm
46
Questions?
Informix Best 48
Practices
Upcoming WAIUG Meeting
• Aug 8th 2017 – Tysons Corner VA
• 8:30-1pm
• What HCL Brings to the Informix World
– Stuart Litel
• Enterprise Replication – Shawn Moe
• Free
• http://www.waiug.org to RSVP
49
Informix Training in 2017
September 11-14, 2017
Advanced Informix Performance Tuning
Thomas Beebe
Advanced DataTools Corporation
[email protected]