Chapter 7 Load Balancing, Failover, and Component Availability


Implementing Sybase Failover for high availability systems

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.

Java Connection Management

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:

JDBC 1.0 and 2.0

Set up jConnect to access LDAP and JNDI with JDBC 1.0 and JDBC 2.0 connections by:

Configuring LDAP

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

Configuring a connection cache

Use Jaguar Manager to configure the connection cache with these values for the specified properties:

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=com
where 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.

JDBC 2.0 extension/JTA drivers

Set up JDBC 2.0 extension / JTA drivers by:

Note   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.

Configuring LDAP

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

Configuring an XA resource

Use Jaguar Manager to configure the connection cache with these values for the specified properties:

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

Troubleshooting the database connection

To find out if your database connection to the LDAP server is working, ping the connection cache.

Steps Pinging the connection cache

  1. Right-click on the connection cache and select Connection Cache Properties.
  2. Click Ping.

If the server does not respond or an error occurs, verify that:

Open Client Client-Library

You can establish high availability Client-Library connections to an Adaptive Server Enterprise database by:

Modifying the client connection information

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 Server1
On 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

Selecting the high availability option

To enable the high availability option for Client Library 11.0 connections, edit the connection cache properties using Jaguar Manager.

Steps Enabling high availability

  1. Expand the Connection Caches folder.
  2. Highlight the connection cache for which you want to enable high availability.
  3. From the File menu, select Connection Cache Properties.
  4. On the Driver tab, select Use HA Connection.

Using the connection APIs

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.