Replication C++ tutorial
Replication quick start tutorial for C++ programmers
Two tutorials are provided to assist you in learning to use the Replication API. They are for JSON and C++ programmers.
drivers\cpp.replication\
This folder contains the tutorial for the Replication C++ API.
drivers\java.rest.replication
This folder contains the tutorial for the Replication JSON RPC API.
These tutorials provide examples of how to use these APIs. They include sample projects that you can compile and run. After compiling the projects, you will start the servers and define the source and target folders that will be used for replication. You can run the projects in debug mode and add breakpoints so you can see how the various calls are used. Additionally, you can review the source code to study the use of the APIs. Procedures for these tutorials are provided in this section.
Compile and run this tutorial to create a simple replication environment. The tutorial code is in the
cpp.replication
orjava.rest.replication
folder of the<faircom>\drivers
folder.Ensure you have already installed the Replication Manager package for your desired platform.
Navigate to the Replication Manager directory and start a Replication server to create an empty replication database.
Start two FairCom servers and create source and target directories for replication.
Locate the source provided in the tutorial directory.
Compile the tutorial using
BuildTutorial.bat
(BuildTutorial shell file or makefile on Linux platforms).Note
BuildTutorial.bat
needs to be run from the Visual Studio x64 Native Tools command prompt unlessvcvars64.bat
is run prior to runningBuildTutorials.bat
.Use the x64 platform.
The only DLL linked for the API is
fcRepl.dll
. TheapiTestCPP.exe
has dependencies on several DLLs (fcRepl.dll
,RCESDPCtree.dll
,RCESBasic.dll
,ctReplAgent.dll
,ctExtFileFilter.dll
).
Start the replication server (
memphis.exe
on Windows andmemphis
on Linux) from the Replication package to create an empty replication database.Prepare two FairCom servers to serve as the source server and the target server.
Ensure the following two lines (after
"; Plugins"
) are uncommented inctsrvr.cfg
.; Plugins PLUGIN cthttpd;./web/cthttpd.dll PLUGIN ctagent;./agent/ctagent.dll
Start servers 1 and 2 to populate both DBEngines into Replication Agent.
Create a source data directory on the source machine — for example,
c:\temp
.Create a target data directory on the target machine — for example,
c:\temp2
.Place some FairCom files that qualify for replication in the
c:\temp
source directory.Execute (or run in debug)
apiTestCPP.exe
.Note
This step uses the
masterAuthFile.set
authentication file with both user and password encrypted to connect to the replication server.Select one server from the provided list as the source DBEngine.
Enter the source data path as
c:\temp
.Note
The path must match the directory name made in Step 6.
Ensure that the files placed in the source data directory are correctly listed.
Select another server from the provided list as the target DBEngine.
Enter the target data path as
c:\temp2
.Note
The path must match the directory name made in Step 7.
Ensure that the files placed in the target data directory are correctly listed.
Open the graphical interface (https://localhost:8440/ReplicationManager/) in a web browser to view what has been executed.