Simple Replication Agent tutorial
Simple tutorial to replicate data between two FairCom servers running on the same computer
This section outlines procedures to configure replication between two FairCom servers running on the same machine. The following procedure includes basic steps for setting up Classic Replication Agent from the FairCom DB V12 package (these same procedures apply for both FairCom Edge and FairCom RTG packages).
Extract the FairCom DB V12 package (
FairCom-DB.<platform>.v12.<version>.<tar.gz or zip>
) on the target machine.Check the following directory tree:
Rename
config/ctagent.json
toconfig/ctagent.json.old
to cause the original file to be ignored by the server.Note
This can easily be reverted.
Copy
config/replication/ctagent.json
toconfig/ctagent.json
.Edit
config/ctagent.json
to leave only onectreplagent.cfg
in theconfigurationFileList
.{ "managed": false, "configurationFileList": [ "../config/replication/ctreplagent1.cfg" ] }
Note
The
ctreplagent.cfg
path is relative to the server’s working directory.Edit
config/replication/ctreplagent1.cfg
and set bothsource_server
andtarget_server
to reflect theSERVER_NAME
fromctsrvr.cfg
and the IP address of the machine that the FairCom server is running on.; Target server connection info target_authfile ../config/replication/target_auth.set target_server FAIRCOM2@127.0.0.1 ; Source server connection info source_authfile ../config/replication/source_auth.set source_server FAIRCOM1@127.0.0.1
Note
If using
SERVER_PORT
instead, the format is<port number>@<network address>
. The#
indicates that the next part will be a number, instead of a string.If authentication information has changed, you will need to generate new
.set
files (see ctcmdset - Configuration File Encoding Utility).
Edit the
config/replication/filter1.xml
file, which is referenced in the following keyword inctreplagent1.cfg
:file_filter <../config/replication/filter1.xml
.If using synchronous replication, add the option
syncagent yes
to thectreplagent.cfg
replication agent configuration file.Update the replication filter rule for replicating all the data files in the default ctreeSQL database path.
<?xml version="1.0" encoding="us-ascii"?> <replfilefilter version="1" persistent="y" agent="REPLAGENT"> <file status="include">.\ctreeSQL.dbs\*.dat</file> <purpose>create_file</purpose> <purpose>read_log</purpose> </replfilefilter>
Note
The
"include"
path is relative to the"data"
directory on the source server.Edit the
config/ctsrvr.cfg
to enable thectagent
plugin by removing the;
in front of the following keyword.PLUGIN ctagent;./agent/ctagent.dll
Start the target server.
Just after initializing the regular FairCom DB server, the
ctagent
plugin will be initialized and the embedded Replication Agent configured in theconfig/ctagent.json
file will be started.Check the following messages in the
data/CTSTATUS.FCS
log file.Wed Nov 11 17:53:12 2020 - User# 00025 ctagentd - Starting Agent Wed Nov 11 17:53:12 2020 - User# 00025 ctagentd - Agent is not managed by Replication Manager... Wed Nov 11 17:53:12 2020 - User# 00025 ctagentd - Agent plugin is ready
Check the FairCom DB log, which is referenced in the following keyword in
ctreplagent.cfg
:log_file_name ../config/replication/replagent1.log
.It should present messages saying that it was able to connect to both source and target servers.
Wed Nov 11 17:53:12 2020: INF: ** Starting replication agent logging for process 21356 Wed Nov 11 17:53:12 2020: INF: Using replication change buffer version 2 Wed Nov 11 17:53:12 2020: INF: Connected to data target 'FAIRCOMS2@localhost'. Wed Nov 11 17:53:12 2020: INF: Connected to data source 'FAIRCOMS@localhost'. Wed Nov 11 17:53:12 2020: INF: Successfully set file filter using XML file '<../config/replication/filter1.xml' Wed Nov 11 17:53:12 2020: INF: Started replication agent. Wed Nov 11 17:53:12 2020: INF: Starting scan with log 1, position 65536
Using SQL Explorer (or any other means), create a new table in the source server’s default ctreeSQL database.
Note
Replication will cause the same file to be created in the target server’s
./data/ctreeSQL.dbs/
directory.In this test, the database operations of adding the new physical files into the database dictionaries are not replicated. The files will be physically created, but they must be manually added to the dictionary.