Debian Codegraph @

docs/programmer_reference/rep.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>Chapter 12.  Berkeley DB Replication</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="index.html" title="Berkeley DB Programmer's Reference Guide" />
11 <link rel="prev" href="transapp_faq.html" title="Transaction FAQ" />
12 <link rel="next" href="rep_id.html" title="Replication environment IDs" />
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">Chapter 12. 
22 Berkeley DB Replication
23 </th>
24 </tr>
25 <tr>
26 <td width="20%" align="left"><a accesskey="p" href="transapp_faq.html">Prev</a> </td>
27 <th width="60%" align="center"> </th>
28 <td width="20%" align="right"> <a accesskey="n" href="rep_id.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="chapter" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title"><a id="rep"></a>Chapter 12. 
38 Berkeley DB Replication
39 </h2>
40 </div>
41 </div>
42 </div>
43 <div class="toc">
44 <p>
45 <b>Table of Contents</b>
46 </p>
47 <dl>
48 <dt>
49 <span class="sect1">
50 <a href="rep.html#rep_intro">Replication introduction</a>
51 </span>
52 </dt>
53 <dt>
54 <span class="sect1">
55 <a href="rep_id.html">Replication environment IDs</a>
56 </span>
57 </dt>
58 <dt>
59 <span class="sect1">
60 <a href="rep_pri.html">Replication environment priorities</a>
61 </span>
62 </dt>
63 <dt>
64 <span class="sect1">
65 <a href="rep_app.html">Building replicated applications</a>
66 </span>
67 </dt>
68 <dt>
69 <span class="sect1">
70 <a href="rep_mgr_meth.html">Replication Manager methods</a>
71 </span>
72 </dt>
73 <dt>
74 <span class="sect1">
75 <a href="rep_base_meth.html">Base API Methods</a>
76 </span>
77 </dt>
78 <dt>
79 <span class="sect1">
80 <a href="rep_comm.html">Building the communications infrastructure</a>
81 </span>
82 </dt>
83 <dt>
84 <span class="sect1">
85 <a href="rep_newsite.html">Connecting to a new site</a>
86 </span>
87 </dt>
88 <dt>
89 <span class="sect1">
90 <a href="group_membership.html">Managing Replication Manager Group Membership</a>
91 </span>
92 </dt>
93 <dd>
94 <dl>
95 <dt>
96 <span class="sect2">
97 <a href="group_membership.html#group_mem_add">Adding Sites to a Replication Group</a>
98 </span>
99 </dt>
100 <dt>
101 <span class="sect2">
102 <a href="group_membership.html#group_mem_remove">Removing Sites from a Replication Group</a>
103 </span>
104 </dt>
105 <dt>
106 <span class="sect2">
107 <a href="group_membership.html#group_mem_primordialstartup">Primordial Startups</a>
108 </span>
109 </dt>
110 <dt>
111 <span class="sect2">
112 <a href="group_membership.html#group_mem_upgrade">Upgrading Groups</a>
113 </span>
114 </dt>
115 </dl>
116 </dd>
117 <dt>
118 <span class="sect1">
119 <a href="rep_filename.html">Managing Replication Files</a>
120 </span>
121 </dt>
122 <dt>
123 <span class="sect1">
124 <a href="rep_mgrmulti.html">Running Replication Manager in multiple processes</a>
125 </span>
126 </dt>
127 <dd>
128 <dl>
129 <dt>
130 <span class="sect2">
131 <a href="rep_mgrmulti.html#idp52420616">One replication process and multiple subordinate processes</a>
132 </span>
133 </dt>
134 <dt>
135 <span class="sect2">
136 <a href="rep_mgrmulti.html#idp52417008">Persistence of local site network address configuration</a>
137 </span>
138 </dt>
139 <dt>
140 <span class="sect2">
141 <a href="rep_mgrmulti.html#idp52400144">Programming considerations</a>
142 </span>
143 </dt>
144 <dt>
145 <span class="sect2">
146 <a href="rep_mgrmulti.html#idp52414488">Handling failure</a>
147 </span>
148 </dt>
149 <dt>
150 <span class="sect2">
151 <a href="rep_mgrmulti.html#idp52412256">Other miscellaneous rules</a>
152 </span>
153 </dt>
154 </dl>
155 </dd>
156 <dt>
157 <span class="sect1">
158 <a href="rep_replicate.html">Running Replication using the db_replicate Utility</a>
159 </span>
160 </dt>
161 <dd>
162 <dl>
163 <dt>
164 <span class="sect2">
165 <a href="rep_replicate.html#idp52430544">One Replication Process and Multiple Subordinate Processes</a>
166 </span>
167 </dt>
168 <dt>
169 <span class="sect2">
170 <a href="rep_replicate.html#idp52447760">Common Use Case</a>
171 </span>
172 </dt>
173 <dt>
174 <span class="sect2">
175 <a href="rep_replicate.html#idp52457840">Avoiding Rollback</a>
176 </span>
177 </dt>
178 <dt>
179 <span class="sect2">
180 <a href="rep_replicate.html#idp52462952">When to Consider an Integrated HA Application</a>
181 </span>
182 </dt>
183 </dl>
184 </dd>
185 <dt>
186 <span class="sect1">
187 <a href="rep_mgr_ack.html">Choosing a Replication Manager Ack Policy</a>
188 </span>
189 </dt>
190 <dt>
191 <span class="sect1">
192 <a href="rep_elect.html">Elections</a>
193 </span>
194 </dt>
195 <dt>
196 <span class="sect1">
197 <a href="rep_mastersync.html">Synchronizing with a master</a>
198 </span>
199 </dt>
200 <dd>
201 <dl>
202 <dt>
203 <span class="sect2">
204 <a href="rep_mastersync.html#rep_delay_sync">Delaying client synchronization</a>
205 </span>
206 </dt>
207 <dt>
208 <span class="sect2">
209 <a href="rep_mastersync.html#rep_c2c_sync">Client-to-client synchronization</a>
210 </span>
211 </dt>
212 <dt>
213 <span class="sect2">
214 <a href="rep_mastersync.html#idp52488504">Blocked client operations</a>
215 </span>
216 </dt>
217 <dt>
218 <span class="sect2">
219 <a href="rep_mastersync.html#idp52510624">Clients too far out-of-date to synchronize</a>
220 </span>
221 </dt>
222 </dl>
223 </dd>
224 <dt>
225 <span class="sect1">
226 <a href="rep_init.html">Initializing a new site</a>
227 </span>
228 </dt>
229 <dt>
230 <span class="sect1">
231 <a href="rep_bulk.html">Bulk transfer</a>
232 </span>
233 </dt>
234 <dt>
235 <span class="sect1">
236 <a href="rep_trans.html">Transactional guarantees</a>
237 </span>
238 </dt>
239 <dt>
240 <span class="sect1">
241 <a href="rep_lease.html">Master Leases</a>
242 </span>
243 </dt>
244 <dd>
245 <dl>
246 <dt>
247 <span class="sect2">
248 <a href="rep_lease.html#masterlease_change_groupsize">Changing Group Size</a>
249 </span>
250 </dt>
251 </dl>
252 </dd>
253 <dt>
254 <span class="sect1">
255 <a href="rep_ryw.html">Read your writes consistency</a>
256 </span>
257 </dt>
258 <dd>
259 <dl>
260 <dt>
261 <span class="sect2">
262 <a href="rep_ryw.html#gettoken">Getting a token</a>
263 </span>
264 </dt>
265 <dt>
266 <span class="sect2">
267 <a href="rep_ryw.html#tokenhandling">Token handling</a>
268 </span>
269 </dt>
270 <dt>
271 <span class="sect2">
272 <a href="rep_ryw.html#usingtoken">Using a token to check or wait for a transaction</a>
273 </span>
274 </dt>
275 </dl>
276 </dd>
277 <dt>
278 <span class="sect1">
279 <a href="rep_clock_skew.html">Clock Skew</a>
280 </span>
281 </dt>
282 <dt>
283 <span class="sect1">
284 <a href="repmgr_channels.html">Using Replication Manager message channels</a>
285 </span>
286 </dt>
287 <dd>
288 <dl>
289 <dt>
290 <span class="sect2">
291 <a href="repmgr_channels.html#dbchannel_class">DB_CHANNEL</a>
292 </span>
293 </dt>
294 <dt>
295 <span class="sect2">
296 <a href="repmgr_channels.html#dbchannel_send">Sending messages over a message channel</a>
297 </span>
298 </dt>
299 <dt>
300 <span class="sect2">
301 <a href="repmgr_channels.html#dbchannel_receive">Receiving messages</a>
302 </span>
303 </dt>
304 </dl>
305 </dd>
306 <dt>
307 <span class="sect1">
308 <a href="rep_twosite.html">Special considerations for two-site replication groups</a>
309 </span>
310 </dt>
311 <dt>
312 <span class="sect1">
313 <a href="rep_partition.html">Network partitions</a>
314 </span>
315 </dt>
316 <dt>
317 <span class="sect1">
318 <a href="rep_faq.html">Replication FAQ</a>
319 </span>
320 </dt>
321 <dt>
322 <span class="sect1">
323 <a href="rep_ex.html">Ex_rep: a replication example</a>
324 </span>
325 </dt>
326 <dt>
327 <span class="sect1">
328 <a href="rep_ex_comm.html">Ex_rep_base: a TCP/IP based communication infrastructure</a>
329 </span>
330 </dt>
331 <dt>
332 <span class="sect1">
333 <a href="rep_ex_rq.html">Ex_rep_base: putting it all together</a>
334 </span>
335 </dt>
336 <dt>
337 <span class="sect1">
338 <a href="rep_ex_chan.html">Ex_rep_chan: a Replication Manager
339 channel example</a>
340 </span>
341 </dt>
342 </dl>
343 </div>
344 <div class="sect1" lang="en" xml:lang="en">
345 <div class="titlepage">
346 <div>
347 <div>
348 <h2 class="title" style="clear: both"><a id="rep_intro"></a>Replication introduction</h2>
349 </div>
350 </div>
351 </div>
352 <p>Berkeley DB includes support for building highly available applications based
353 on replication. Berkeley DB replication groups consist of some number of
354 independently configured database environments. There is a single
355 <span class="emphasis"><em>master</em></span> database environment and one or more <span class="emphasis"><em>client</em></span>
356 database environments. Master environments support both database reads
357 and writes; client environments support only database reads. If the
358 master environment fails, applications may upgrade a client to be the
359 new master. The database environments might be on separate computers,
360 on separate hardware partitions in a non-uniform memory access (NUMA)
361 system, or on separate disks in a single server.
362 As always with Berkeley DB environments, any number of
363 concurrent processes or threads may access a database environment. In
364 the case of a master environment, any number of threads of control may
365 read and write the environment, and in the case of a client environment,
366 any number of threads of control may read the environment.</p>
367 <p>Applications may be written to provide various degrees of consistency
368 between the master and clients. The system can be run synchronously
369 such that replicas are guaranteed to be up-to-date with all committed
370 transactions, but doing so may incur a significant performance penalty.
371 Higher performance solutions sacrifice total consistency, allowing the
372 clients to be out of date for an application-controlled amount of
373 time.</p>
374 <p>
375 There are two ways to build replicated applications. The simpler way
376 is to use the Berkeley DB Replication Manager. The Replication Manager
377 provides a standard communications infrastructure, and it creates and
378 manages the background threads needed for processing replication
379 messages.
380 </p>
381 <p>The Replication Manager implementation is based on TCP/IP sockets, and
382 uses POSIX 1003.1 style networking and thread support. (On Windows
383 systems, it uses standard Windows thread support.) As a result, it is
384 not as portable as the rest of the Berkeley DB library itself.</p>
385 <p>The alternative is to use the lower-level replication "Base APIs". This
386 approach affords more flexibility, but requires the application to
387 provide some critical components:</p>
388 <div class="orderedlist">
389 <ol type="1">
390 <li>A communication infrastructure. Applications may use whatever wire
391 protocol is appropriate for their application (for example, RPC, TCP/IP,
392 UDP, VI or message-passing over the backplane).</li>
393 <li>The application is responsible for naming. Berkeley DB refers to the members
394 of a replication group using an application-provided ID, and
395 applications must map that ID to a particular database environment or
396 communication channel.</li>
397 <li>The application is responsible for monitoring the status of the master
398 and clients, and identifying any unavailable database environments.</li>
399 <li>The application must provide whatever security policies are needed.
400 For example, the application may choose to encrypt data, use a secure
401 socket layer, or do nothing at all. The level of security is left to
402 the sole discretion of the application.</li>
403 </ol>
404 </div>
405 <p>(Note that Replication Manager does not provide wire security for
406 replication messages.)</p>
407 <p>The following pages present various programming considerations, many of
408 which are directly relevant only for Base API applications. However, even when using Replication Manager it is
409 important to understand the concepts.</p>
410 <p>Finally, the Berkeley DB replication implementation has one other additional
411 feature to increase application reliability. Replication in Berkeley DB is
412 implemented to perform database updates using a different code path than
413 the standard ones. This means operations that manage to crash the
414 replication master due to a software bug will not necessarily also crash
415 replication clients.</p>
416 <p>For more information on the replication manager operations, see the <a href="../api_reference/C/rep.html#replist" class="olink">Replication and Related Methods</a> section in the <em class="citetitle">Berkeley DB C API Reference Guide.</em> </p>
417 </div>
418 </div>
419 <div class="navfooter">
420 <hr />
421 <table width="100%" summary="Navigation footer">
422 <tr>
423 <td width="40%" align="left"><a accesskey="p" href="transapp_faq.html">Prev</a> </td>
424 <td width="20%" align="center"> </td>
425 <td width="40%" align="right"> <a accesskey="n" href="rep_id.html">Next</a></td>
426 </tr>
427 <tr>
428 <td width="40%" align="left" valign="top">Transaction FAQ </td>
429 <td width="20%" align="center">
430 <a accesskey="h" href="index.html">Home</a>
431 </td>
432 <td width="40%" align="right" valign="top"> Replication environment IDs</td>
433 </tr>
434 </table>
435 </div>
436 </body>
437 </html>