Skip to main content

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

  1. Extract the FairCom DB V12 package (FairCom-DB.<platform>.v12.<version>.<tar.gz or zip>) on the target machine.

  2. Check the following directory tree:

    FairCom-DB.WinX64.v12.0.0.121 > config > replication
  3. Rename config/ctagent.json to config/ctagent.json.old to cause the original file to be ignored by the server.

    Note

    This can easily be reverted.

  4. Copy config/replication/ctagent.json to config/ctagent.json.

  5. Edit config/ctagent.json to leave only one ctreplagent.cfg in the configurationFileList.

    {
        "managed": false,
        "configurationFileList": [
        "../config/replication/ctreplagent1.cfg"
        ]
    }

    Note

    The ctreplagent.cfg path is relative to the server’s working directory.

  6. Edit config/replication/ctreplagent1.cfg and set both source_server and target_server to reflect the SERVER_NAME from ctsrvr.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).

  7. Edit the config/replication/filter1.xml file, which is referenced in the following keyword in ctreplagent1.cfgfile_filter <../config/replication/filter1.xml.

    If using synchronous replication, add the option syncagent yes to the ctreplagent.cfg replication agent configuration file.

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

  9. Edit the config/ctsrvr.cfg to enable the ctagent plugin by removing the ; in front of the following keyword.

    PLUGIN ctagent;./agent/ctagent.dll
  10. 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 the config/ctagent.json file will be started.

  11. 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
  12. Check the FairCom DB log, which is referenced in the following keyword in ctreplagent.cfglog_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
  13. 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.