Chapter 7 Load Balancing, Failover, and Component Availability
You can implement the Sybase Failover for High Availability Systems (failover) feature in Adaptive Server Enterprise 12.0 and higher with EAServer database connectivity using either Java Connection Management (JCM) or the Sybase Open Client Client-Library.
You configure JCM by enabling Java Database Connectivity (JDBC) connections to establish failover-enabled connections to Adaptive Server Enterprise. jConnect requires that the connection's attributes be configured on an LDAP server and accessed using JNDI. See the jConnect and JNDI documentation for more details on the jConnect configuration for LDAP.
You may need to configure your LDAP server to accept the Sybase schema extensions. You can find the schema definitions in the sybase.schema file located in the $SYBASE_OCS/config directory of your Adaptive Server installation. For information on configuring your LDAP server, see your LDAP server documentation.
You can implement failover using:
Set up jConnect to access LDAP and JNDI with JDBC 1.0 and JDBC 2.0 connections by:
To configure LDAP, run your server with JDK 1.2 and use your LDAP software to set up an LDAP entry of this form. In this example, primary_server is the name of the high availability (HA) primary server, secondary_server is its secondary server, and host and port are the host name and port number of the machine on which the database server runs.
dn: sybaseServername=primary_server, dc=sybase, dc=com sybaseServername: primary_server sybaseAddress: TCP#1#host port sybaseHAservername: sybaseServername=secondary_server sybaseJconnectProperty: REQUEST_HA_SESSION=true sybaseJconnectProperty: Tds objectclass: sybaseServer dn: sybaseServername=secondary_server, dc=sybase, dc=com sybaseServername: secondary_server sybaseAddress: TCP#1#host port objectclass: sybaseServer
Use Jaguar Manager to configure the connection cache with these values for the specified properties:
DBuid
DBpasswd
jdbc:sybase:jndi:ldap:sybaseServername=primary_server
To specify additional properties that EAServer uses for LDAP server configuration, create a <cache_name>.props file in the $JAGUAR/Repository/ConnCache directory, and set these property values:
java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory java.naming.factory.object=com.sybase.jdbc2.jdbc.SybObjectFactory java.naming.provider.url=ldap://duplo:389/dc=sybase,dc=comwhere duplo:389 is the port where the LDAP server is running. The values listed for the first two properties are the defaults used by EAServer.
Set up JDBC 2.0 extension / JTA drivers by:
When failover occurs, EAServer supports XA transactions
only if they are in the prepared
state. XA
transactions in any other state are lost. For information on transactions,
see Chapter 2, "Understanding Transactions and Component
Lifecycles," in the EAServer Programmer's
Guide.
Using your LDAP software, set up an LDAP entry of this form:
dn: sybaseServername=primary_xa_server,dc=sybase,dc=com sybaseServername: primary_xa_server sybaseAddress: TCP#1#host port sybaseHAservername: sybaseServername=secondary_xa_server sybaseJconnectProperty: REQUEST_HA_SESSION=true sybaseJconnectProperty: Tds objectclass: sybaseServer dn: sybaseServername=secondary_xa_server,dc=sybase,dc=com sybaseServername=secondary_xa_server sybaseAddress: TCP#1#host port objectclass: sybaseServer
Use Jaguar Manager to configure the connection cache with these values for the specified properties:
DBuid
DBpasswd
LDAPLOOKUP=sybaseServername=primary_xa_server
com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
Create a <cache_name>.props file in the $JAGUAR/Repository/ConnCache directory, and set this property value, where duplo:389 is the port where the LDAP server is running:
java.naming.provider.url=ldap://duplo:389/dc=sybase,dc=com
To find out if your database connection to the LDAP server is working, ping the connection cache.
Pinging
the connection cache
If the server does not respond or an error occurs, verify that:
You can establish high availability Client-Library connections to an Adaptive Server Enterprise database by:
On UNIX platforms, set these values in your interfaces file:
Server1 master tcp ether Server1-host 5000 query tcp ether Server1-host 5000 hafailover Server2
Server2 master tcp ether Server2-host 5001 query tcp ether Server2-host 5001 hafailover Server1On Windows platforms, set these values in the%JAGUAR%\ini\sql.ini file:
[Server1] master=NLWNSCK,Server1-host,5200 query=NLWNSCK,Server1-host,5200 hafailover=Server2
[Server2] master=NLWNSCK,Server2-host,5300 query=NLWNSCK,Server2-host,5300 hafailover=Server1
To enable the high availability option for Client Library 11.0 connections, edit the connection cache properties using Jaguar Manager.
Enabling high availability
Set the CS_HAFAILOVER property using the ct_config and ct_con_props CTLIB API calls. You can set this property at either the context or the connection level, using this syntax:
ct_config(context, action, CS_HAFAILOVER, buf, buflen, outlen) ct_con_props(connection, action, CS_HAFAILOVER, buf, buflen, outlen)
For more information on using the CTLIB API calls, see Using Sybase Failover in a High Availability System, which is available in the Sybase online book collection .
Copyright © 2002 Sybase, Inc. All rights reserved. |
![]() |