Administering and Monitoring Replication

<< Setting Up Replication Environment Options - TOC - Tools For Replication >>

This chapter describes how to administer and monitor CSQL Replication using replication tools and utilities.

These are the two tools, which are involved in replication process.

  • csql
  • repltable

This two simple deployment options are used for the demonstration purpose:

  • Active - Standby
  • Active – Active

In below examples, two deployment scenarios have been represented, first one is Active- Standby and the second one is Active-Active on two CSQL Instances for the sake of easiness. For each deployment scenario both synchronous and asynchronous mode is used one after another.

Active – Standby

This Active-Standby deployment means the Source site is always used as Active site and the Destination site is always used as Standby. The two sites are in two different machines and are connected through the network. If Source Site goes down application can connect to the Destination Site and continue the operation.

The one way replication mode is used for this deployment and they can be,

  • Synchronous
  • Asynchronous

The two instances of CSQL should work in two different machines, for that we have to configure the replication and set up the network file which contains the information about the peer site.

Based on this deployment, CSQL Instance-1 is considered as Source site or Active Site, CSQL Instance –2 is considered as Destination Site or Standby Site. The Replication configuration is made accordingly both in csql.conf file and csqlnw.conf file.

Configure csql.conf file for CSQL Instance – 1

The Replication configuration parameters in the csql.conf file should look like the below contents.

DURABILITY=ON
SITE_ID=1
CSQL_SQL_SERVER=true
PORT=5678
REPLICATION=true
REPLICATION_SITES=16
NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf
CONFL_RESO_FILE=/tmp/csql/conflResoFile.sql
MSG_KEY=2525
ID_SHM_KEY=1947
ASYNC_MSGMAX=8192
MAX_QUEUE_LOGS=100

Configure csql.conf file for CSQL Instance – 2

The Replication configuration parameters in the csql.conf file should look like the below contents.

DURABILITY=ON
SITE_ID=2
CSQL_SQL_SERVER=true
PORT=5678
REPLICATION=true
REPLICATION_SITES=16
NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf
CONFL_RESO_FILE=/tmp/csql/conflResoFile.sql
MSG_KEY=2525
ID_SHM_KEY=1947
ASYNC_MSGMAX=8192
MAX_QUEUE_LOGS=100
In the above Configuration parameters, SITE_ID is the only parameter which is changed. The next step is configuring csqlnw.conf file.

Configure csqlnw.conf file :

The network configuration file should contain the information about both the CSQL Instances and it should contain the below specified information. The file path has to be mentioned in the NETWORK_CONFIG_FILE parameter in csql.conf file.

File Format:

ID : IP_address : Port : Repl_Mode

Synchronous Replication

In case of synchronous mode, source site transaction commits return only after the transaction is committed at source instance and other destination instances in the quorum. Site-1 Site-2

Fig 1-11. Synchronous Replication

Information in csqlnw.conf file at Instance-1

2 : 192.168.1.111 : 5678 : SYNC

The contents in csqlnw.conf file provide information about CSQL Instance-2, which is required by CSQL Instance-1 to connect and replicates data.

Steps to replicate table :

Follow the below steps to replicate data from Instance-1 to Instance-2.

Before begin with operations, Start the CSQL Server in two hosts with all necessary configuration parameters in csql.conf file. Refer CSQL User Manual to start the server.

Start the CSQL Server at both the Instances.

The below contents shows that all the required servers are running and it should matched at your both the Sites except Server’s PID value.

$ csqlserver
Sys_DB [Size=0001MB]
User_DB [Size=0010MB]
Network Server Started [PID=21640]
Replication Server Started [PID=21641]
Database Server Started...

Publish the table at Instance-1 using “repltable” tool

Lets assume that the “emp” table is present at the Instance-1 with some records.

Use repltable tool to publish the table.

Refer the Section Tools For Replication, for repltable too with all the options.

$ repltable –t emp
After executing this command entry will be made into the csqltable.conf file.

Subscribe the table at Instance-2

By executing the below command the table is replicated (Subscribed) at Instance-2 and the entry is made in cachetable.conf file.

$ repltable –t emp
Now the table ‘t1’ is present in Source Site as well as in Destination Site. Insert some records at Instance-1 and it will be replicated to Instance-2.

Asynchronous Replication

In case of asynchronous mode, source site transaction commit return immediately after the transaction is committed at the source site. Replication process takes care of applying these transactions at destination sites in the quorum. This mode gives high throughput. Site-1 Site-2

Fig 1-12. Asynchronous Replication.

To test this mode you can keep the above configurations, which have been made in csql.conf file both for Source Site and Destination Site. The change, which needs to be made that, is in csqlnw.conf file only.

Information in csqlnw.conf file at Instance-1 :

2 : 192.168.1.138 : 5678 : ASYNC

The contents in csqlnw.conf file provide information about CSQL Instance-2, which is required by CSQL Instance-1 to connect and replicates data.

Follow the above section “Steps to Replicate table” to carry out replication.

For any reasons, if Active Site goes down, the application should connect to the Standby Site.

Active – Active

This Active-Active deployment means both the Source Site and Destination site is active and take part in replication. Application can access any of the sites at any point of time and the data should be consistent in both the database. The two sites are in two different machines and could connect through the network.

The two-way replication mode is used for this deployment and these are,

  • Synchronous
  • Asynchronous

For configuration in csql.conf file, follow the 6.1. Active-Standby deployment option for two CSQL Instances. The only change that needs to take part is in csqlnw.conf file only for both the Instances at both sites Site-1 Site-2

Fig 1-13. Replication in Sync/Async in Active-Active Deployment option

Follow the 6.1.Active-StandBy Section to configure csql.conf file, which will be same for this mode also. The csqlnw.conf file only needs to be changed according to the Sync or Async mode.

Synchronous Replication

In case of synchronous mode, source site transaction commits return only after the transaction is committed at source instance and other destination instances in the quorum. Information in the csqlnw.conf file at Instance-1 and Instance-2:

1 : 192.168.1.111 : 5678 : SYNC
2 : 192.168.1.111 : 5678 : SYNC

The first line out of the above two in csqlnw.conf file provides information about CSQL Instance-1, which is required by CSQL Instance-2 to connect and replicates data. And the second line provides the information about CSQL Instance-2, which is required by CSQL-Instance-1.

Follow the section “Steps to Replicate Table”, which have been defined in the Section 6.1.2.Synchronous Replication for Active-Stand By scenario to publish and subscribe table at both the site.

Asynchronous Replication

In case of asynchronous mode, source site transaction commit return immediately after the transaction is committed at the source site. Replication process takes care of applying these transactions at destination sites in the quorum.

Information in the csqlnw.conf file :

1 : 192.168.1.111 : 5678 : ASYNC
2 : 192.168.1.111 : 5678 : ASYNC

After setting up the ASYNC mode replication, user can publish the table at Source Site and subscribe the table at Destination Site. Follow the above mentioned section “Steps to Replicate Table” to do it.

In Active-Active deployment scenario, if any one of the site goes down then data will available in other site and application can connect to it and when it comes up it connects to its peer sites and back it its normal position.

Note: In case of Asynchronous active-active configuration, when updates happen on the same record in both the sites simultaneously, conflicts can arise or data at both sites may converge. Administrator should check for any conflicts and verify consistency of data and fix them manually.

<< Setting Up Replication Environment Options - TOC - Tools For Replication >>

Page last modified on October 13, 2009, at 11:11 PM