In this tutorial you will learn how to set up a cluster of one or more servers. If the database detects a failure of the primary database server, it will automatically fail over to a secondary database server. This model does not require the operating system to provide clustering.
The following steps show how to implement a replication plan for “Automatic Database Failover” mode with FairCom Server V12 zip packages. These steps apply to setting up replication between any FairCom Server type: FairCom DB, FairCom Edge, and FairCom RTG.
The following process uses the "Availability Group" feature in Replication Manager.
Connect to Replication Manager
In a web browser, navigate to https://<ReplicationManagerHostName>:19992/
Select Replication Manager.
In the Connection Options dialog, enter appropriate credentials and click Connect.
(If you have set up additional servers then your view will show more servers than shown below. This tutorial will utilize two FairCom Servers along with the FairCom Replication Manager Server)
Create a Test Table
Connect FairCom SQL Explorer to the first FairCom Server by doing the following:
In a web browser, navigate to https://<ReplicationManagerHostName>:19992/
Select SQL Explorer.
In the Connect to Server and Database dialog, enter the Hostname (or IP address) and Port Number (19791) for the first FairCom Server.
With appropriate credentials entered click Connect to Server.
Right-click on Tables in the Server pane and select Create New Table:
Populate table schema and create a new table:
Click Create. A modal window will say Table Successfully Created. Click OK to close that dialog.
Set an Availability Group
In Replication Manager, right-click the replication source FairCom Server (where a table was just created) and select Create New Publication.
Check the Published check box for the table just created and click Save & Close:
From the Actions option in the main menu, select Manage Availability Groups:
Enter a new Availability Group Name and click Save:
From the list of servers displayed, find the publication created above. For this server, check both Included and Primary columns and in the Publication column select the publication created:
Check the Included column for the other servers that are supposed to be added into the Availability Group and click Save & Close:
Hint: If the Availability Group does not organize the servers to your liking, you can rearrange them into a configuration that makes sense for your needs:
From the Settings button in the top-right corner, select Deploy:
At this point, the Availability Group will execute the following actions:
Change the secondary servers to be read-only, so they will be represented in orange.
Copy the published files over to the secondary servers.
Start the replication process, keeping the destination servers in sync with the source.
Replication should now be live with High Availability and Database Failover configured via Availability Group functionality.
Connecting to the Availability Group
The following steps are required to get your application working with the Availability Group that was just configured.
Open the source code in any of the following tutorials directories:
<faircom>/drivers/c.isam/tutorials/
<faircom>/drivers/c.nav/tutorials/
<faircom>/drivers/cpp.nav/tutorials/
Locate the Initialize() function.
Just before the logon is executed, add the following lines of code (to configure the connection to take advantage of the Availability Group features):
This function establishes a list of servers available for failover.
Shown above are two ways to identify the secondary servers included in the Availability group. The first (FAIRCOM2@127.0.0.1) shows the server as name@ip_address, the second (#19810@localhost) example shows the server as port@hostname.
Please note that, with failover enabled, there is no manual connection made to a specific server in the Availability Group. Connections are determined and handled automatically by the Availability Group interface.
connectionMode can be either \”read\” (read-only) or \”write\” (read/write). Based on this setting, the Availability Group will determine which node to connect to.
acceptableLatency time is set in seconds (60 seconds above)
Additional parameter options for configuring the connection request will be included in a future release.
Adjust the logon function to use settings that will work for the read/write server in your configuration (FAIRCOM1 in the example above), then compile and run that code.