Managing Heartbeats
Prev | Chapter 3. The DB Replication Framework | Next

## Managing Heartbeats

If your replicated application experiences few updates, it is possible for the replication group to lose a master without noticing it. This is because normally a replicated application only knows that a master has gone missing when update activity causes messages to be passed between the master and clients.

To guard against this, you can configure a heartbeat. The heartbeat must be configured for both the master and each of the clients.

On the master, you configure the application to send a heartbeat on a defined interval when it is otherwise idle. Do this by using the `DB_REP_HEARTBEAT_SEND` flag with the `DbEnv::rep_set_timeout()` method. You must also provide the method a value representing the frequency of the heartbeat. Note that the heartbeat is sent only if the system is idle.

On the client, you configure the application to listen for a heartbeat. The time that you configure here is the amount of time the client will wait for some message from the master (either the heartbeat or some other message) before concluding that the connection is lost. You do this using the `DB_REP_HEARTBEAT_MONITOR` flag with the `DbEnv::rep_set_timeout()` method and a timeout value in microseconds.

Prev | Up | Next
Managing Connection Retries | Home | Chapter 4. Replica versus Master Processes