Debian Codegraph @

docs/programmer_reference/rep_twosite.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>Special considerations for two-site replication groups</title>
7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
10 <link rel="up" href="rep.html" title="Chapter 12.  Berkeley DB Replication" />
11 <link rel="prev" href="repmgr_channels.html" title="Using Replication Manager message channels" />
12 <link rel="next" href="rep_partition.html" title="Network partitions" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">Special considerations for two-site replication groups</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="repmgr_channels.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 12. 
26 Berkeley DB Replication
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="rep_partition.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="rep_twosite"></a>Special considerations for two-site replication groups</h2>
38 </div>
39 </div>
40 </div>
41 <p>
42 One of the benefits of replication is that it helps your
43 application remain available for writes even when a site crashes.
44 Another benefit is the added durability achieved by storing multiple
45 copies of your application data at different sites. However, if
46 your replication group contains only two sites, you must prioritize
47 which of these benefits is more important to your
48 application.
49 </p>
50 <p>
51 A two-site replication group is particularly vulnerable to
52 duplicate masters if there is a loss of communication between the
53 sites. The original master continues to accept new transactions.
54 If the original client detects the loss of the master and elects
55 itself master, it also starts accepting new transactions. When
56 communications are restored, there are duplicate masters and one
57 site's new transactions will be rolled back.
58 </p>
59 <p>
60 If it is unacceptable to your application for any new transactions
61 to be rolled back, the alternative in a two-site replication group
62 is to require both sites to be present in order to elect a master.
63 This stops a client from electing itself master when it loses
64 contact with the master and prevents creation of parallel sets of
65 transactions, one of which must be rolled back.
66 </p>
67 <p>
68 However, requiring both sites to be present to elect a master
69 results in a loss of write availability when the master crashes.
70 The client cannot take over as master and the replication group
71 exists in a read-only state until the original master site rejoins
72 the replication group.
73 </p>
74 <p>
75 Replication Manager applications use the <a href="../api_reference/C/repconfig.html" class="olink">DB_ENV-&gt;rep_set_config()</a> method
76 <a href="../api_reference/C/repconfig.html#config_DB_REPMGR_CONF_2SITE_STRICT" class="olink">DB_REPMGR_CONF_2SITE_STRICT</a> flag to make this tradeoff between
77 write availability and transaction durability. When this flag is
78 turned on, Replication Manager favors transaction durability. When
79 it is turned off, Replication Manager favors write
80 availability.
81 </p>
82 <p>
83 A two-site Replication Manager application that uses heartbeats in
84 an environment with frequent communications disruptions generally
85 should operate with the <a href="../api_reference/C/repconfig.html#config_DB_REPMGR_CONF_2SITE_STRICT" class="olink">DB_REPMGR_CONF_2SITE_STRICT</a> flag turned
86 on. Otherwise, frequent heartbeat failures will cause frequent
87 duplicate masters and the resulting elections and client
88 synchronizations will make one or both sites unavailable for
89 extended periods of time.
90 </p>
91 <p>
92 Base API applications use the values of the
93 <span class="bold"><strong>nvotes</strong></span> and
94 <span class="bold"><strong>nsites</strong></span> parameters in calls to the
95 <a href="../api_reference/C/repelect.html" class="olink">DB_ENV-&gt;rep_elect()</a> method to make this tradeoff. For more information, see
96 <a class="xref" href="rep_elect.html" title="Elections">Elections</a>.</p>
97 <p>
98 A replication group containing only two electable sites is subject
99 to duplicate masters and rollback of one site's new transactions
100 even when it contains additional unelectable sites. The
101 <a href="../api_reference/C/repconfig.html#config_DB_REPMGR_CONF_2SITE_STRICT" class="olink">DB_REPMGR_CONF_2SITE_STRICT</a> does not apply in this case because
102 the replication group is larger than two sites.
103 </p>
104 <p>
105 If both write availability and transaction durability are important
106 to your application, you should strongly consider having three or
107 more electable sites in your replication group. You should also
108 carefully choose an acknowledgement policy that requires at least a
109 quorum of sites. It is best to have an odd number of electable
110 sites to provide a clear majority in the event of a network
111 partition.
112 </p>
113 </div>
114 <div class="navfooter">
115 <hr />
116 <table width="100%" summary="Navigation footer">
117 <tr>
118 <td width="40%" align="left"><a accesskey="p" href="repmgr_channels.html">Prev</a> </td>
119 <td width="20%" align="center">
120 <a accesskey="u" href="rep.html">Up</a>
121 </td>
122 <td width="40%" align="right"> <a accesskey="n" href="rep_partition.html">Next</a></td>
123 </tr>
124 <tr>
125 <td width="40%" align="left" valign="top">Using Replication Manager message channels </td>
126 <td width="20%" align="center">
127 <a accesskey="h" href="index.html">Home</a>
128 </td>
129 <td width="40%" align="right" valign="top"> Network partitions</td>
130 </tr>
131 </table>
132 </div>
133 </body>
134 </html>