Replication Manager methods

Applications which use the Replication Manager support generally call the following Berkeley DB methods. The general pattern is to call various methods to configure Replication Manager, and then start it by calling DB_ENV->repmgr_start(). Once this initialization is complete, the application rarely needs to call any of these methods. (A prime example of an exception to this rule would be the DB_ENV->rep_sync() method, if the application is Delaying client synchronization.)


The DB_ENV->repmgr_set_local_site() method configures the TCP/IP address of the local site, by specifying the port number on which it is to listen for incoming connection requests. This method must be called exactly once before calling DB_ENV->repmgr_start().


The DB_ENV->repmgr_add_remote_site() method adds a remote site to the list of sites initially known by the local site. The remote site is specified in terms of a TCP/IP network address: host name and port number. This method may be called as many times as necessary to configure all known remote sites. Note that it is usually not necessary for each site in the replication group initially to know about all other sites in the group. Sites can discover each other dynamically, as described in Connecting to a new site.


The DB_ENV->repmgr_set_ack_policy() method configures the acknowledgement policy to be used in the replication group, in other words, the behavior of the master with respect to acknowledgements for "permanent" messages, which implements the application's requirements for Transactional guarantees. The current implementation requires all sites in the replication group to configure the same acknowledgement policy.


The DB_ENV->rep_set_nsites() method tells Replication Manager the total number of sites in the replication group. This is usually necessary for proper operation of elections, and for counting message acknowledgements (depending on the acknowledgement policy).


The DB_ENV->rep_set_priority() method configures the local site's priority for the purpose of elections.


This method optionally configures various timeout values. Otherwise default timeout values as specified in DB_ENV->rep_set_timeout() are used. In particular, Replication Manager client sites can be configured to monitor the health of the TCP/IP connection to the master site using heartbeat messages. If the client receives no messages from the master for a certain amount of time, it considers the connection to be broken, and calls for an election to choose a new master.


Once configured and started, Replication Manager does virtually all of its work in the background, usually without the need for any direct communication with the application. However, occasionally events occur which the application may be interested in knowing about. The application can request notification of these events by calling the DB_ENV->set_event_notify() method.


The DB_ENV->repmgr_start() method starts the replication system. It opens the listening TCP/IP socket and creates all the background processing threads that will be needed.

In addition to the methods previously described, Replication Manager applications may also call the following methods, as needed: DB_ENV->rep_set_config(), DB_ENV->rep_set_limit(), DB_ENV->rep_set_request(), DB_ENV->rep_sync() and DB_ENV->rep_stat().