FRONTBASE TECHNICAL NOTES
FRONTBASE TECHNICAL NOTES

Replication Clusters

By: Svend Bodilsen, FrontBase,November 15, 2000

A replication cluster is a number of database servers which implements one database, a client can connect to any server in the cluster and access and update the database.

1. What a cluster does for you

To achieve the full benefit of a FrontBase™ cluster the database servers must run on separate machines. If so, a FrontBase cluster does the following for you:

Enhanced data security

Each database server in the cluster holds a complete copy of the database, as long as one machine remains intact no data will be lost.

Load distribution

A typical client application will execute read transactions with a rate that is orders of magnitude larger than the rate of read/write transactions, and a read transaction will only access the cluster member it is connected to, thus the load can be distributed.

Hot spare

When a client loses a connection to one database in the cluster, it can simply connect to an other, the only data that may be lost are the outstanding transactions.

2. Implementation

2.1 Two Phase Commit

When a client modifies a member of the cluster the other members of the cluster must be updated before the modifications can be committed. When the members of the cluster are updated the transaction is committed with the two phase commit algorithm, which ensures that the transaction is either committed on all the cluster members or on none.

2.2 Cold starting a cluster

When the first member of a cluster is started, it is assumed that the database has the latest version of the database. As the server is the only one in the cluster it is not necessary to synchronize.

2.3 Adding members to the cluster

When the remaining members of the cluster are started they will determine the members of the cluster, and roll the new member forward in order to synchronize with the cluster. If it is not possible to synchronize the new member and the cluster the new member aborts. When the new member is synchronized it will allow clients to connect and it will receive updates from the rest of the cluster members.

2.4 Removing members from the cluster

Removing a member from the cluster is simple, just kill the server.

2.5 Clients connection to the Cluster

When a client wants to connect to a cluster it can try to connect to one of the members, and if that fails try the second and so forth until either a usable server is found or all the servers have been tried and failed, in which case it is impossible to connect to the cluster.

3. Configuration

3.1 Starting a database cluster

A member in a cluster is started with the following option:

   -rcluster="<database@hostname>,... <database-name>"

The rcluster specifies the initial cluster list, the database server being started will attempt to connect to the databases servers in the list, and synchronize with them. The initial cluster list needs not be complete as the server will obtain the actual member list from members of the cluster.

The commands for starting the database servers should be included in the bootstrap procedure for the machines.

Example:

In order to initiate a cluster for the database db0 on 3 machines, m1, m2 and m3, execute the following shell commands on the machines:

On m1 execute:

   m1> FrontBase -rcluster="db0@m1,db0@m2,db0@m3" db0

On m2 execute:

   m2> FrontBase -rcluster="db0@m1,db0@m2,db0@m3" db0

On m3 execute:

   m3> FrontBase -rcluster="db0@m1,db0@m2,db0@m3" db0

Please note that the commands are identical, it is legal to include "self" in the initial cluster list.

If you want to add a new member to the cluster later you can use the command:

   m4> FrontBase -rcluster="db0@m1" db0

The server will derive the full cluster from db0@m1, so you do not need to specify the complete list.