There are two ways to build Berkeley DB replication applications: the most common approach is to use the Berkeley DB library "replication manager" support, where the Berkeley DB library manages the replication group, including network transport, all replication message processing and acknowledgment, and group elections. Applications using the replication manager support generally make the following calls:
- Configure the local site in the replication group, RepMgrLocalSite.
- Call RepMgrSiteConfig(DbSiteConfig) to configure the remote site(s) in the replication group.
- Configure the message acknowledgment policy (RepMgrAckPolicy) which provides the replication group's transactional needs.
- Configure the local site's election priority, RepPriority.
- Call RepMgrStartClient(Int32) or RepMgrStartMaster(Int32) to start the replication application.
For more information on building replication manager applications, please see the Replication Getting Started Guide included in the Berkeley DB documentation.
Applications with special needs (for example, applications using network protocols not supported by the Berkeley DB replication manager), must perform additional configuration and call other Berkeley DB replication methods. For more information on building advanced replication applications, please see the Base Replication API section in the Berkeley DB Programmer's Reference Guide for more information.
Starting the replication manager consists of opening the TCP/IP listening socket to accept incoming connections, and starting all necessary background threads. When multiple processes share a database environment, only one process can open the listening socket; RepMgrStartClient(Int32) (and RepMgrStartMaster(Int32)) automatically open the socket in the first process to call it, and skips this step in the later calls from other processes.
Start the replication manager as a client site, and do not call for an election.
Start the replication manager as a client site, and optionally call for an election.