• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/timemachine/db-4.7.25.NC/docs/gsg_db_rep/C/
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>The Replication APIs</title>
7    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
8    <meta name="generator" content="DocBook XSL Stylesheets V1.62.4" />
9    <link rel="home" href="index.html" title="Getting Started with Replicated Berkeley DB Applications" />
10    <link rel="up" href="introduction.html" title="Chapter��1.��Introduction" />
11    <link rel="previous" href="repadvantage.html" title="Replication Benefits" />
12    <link rel="next" href="elections.html" title="Holding Elections" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">The Replication APIs</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="repadvantage.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��1.��Introduction</th>
23          <td width="20%" align="right">��<a accesskey="n" href="elections.html">Next</a></td>
24        </tr>
25      </table>
26      <hr />
27    </div>
28    <div class="sect1" lang="en" xml:lang="en">
29      <div class="titlepage">
30        <div>
31          <div>
32            <h2 class="title" style="clear: both"><a id="apioverview"></a>The Replication APIs</h2>
33          </div>
34        </div>
35        <div></div>
36      </div>
37      <p>
38                There are two ways that you can choose to implement
39                replication in your transactional application. The first,
40                and preferred, mechanism is to use the pre-packaged
41                replication framework that comes with the
42                DB distribution. This framework should be sufficient
43                for most customers.
44            </p>
45      <p>
46                If for some reason the Replication Framework
47                does not meet your application's technical requirements,
48                you will have to use the replication APIs available
49                through the Berkeley DB  library to write your own custom
50                replication framework. 
51            </p>
52      <p>
53                Both of these approaches are described in slightly greater
54                detail in this section. The bulk of the chapters later in
55                this book are dedicated to these two replication
56                implementation mechanisms. 
57            </p>
58      <div class="sect2" lang="en" xml:lang="en">
59        <div class="titlepage">
60          <div>
61            <div>
62              <h3 class="title"><a id="repframeworkoverview"></a>Replication Framework Overview</h3>
63            </div>
64          </div>
65          <div></div>
66        </div>
67        <p>
68                    DB's pre-packaged replication framework exists
69                    as a layer on top of the DB library. The replication framework is a
70                    multi-threaded implementation that allows you to easily add
71                    replication to your existing transactional application.
72                    <span>
73                    You access and manage the replication framework using methods that are
74                    available off the 
75                        <tt class="classname">DB_ENV</tt>
76                        
77                    class.
78                    </span>
79                    
80                </p>
81        <p>
82                    The replication framework:
83                </p>
84        <div class="itemizedlist">
85          <ul type="disc">
86            <li>
87              <p>
88                            Provides a multi-threaded communications layer
89                            using pthreads (on Unix-style systems and
90                            similar derivatives such as Mac OS X), or
91                            Windows threads on Microsoft Windows systems.
92                        </p>
93            </li>
94            <li>
95              <p>
96                                Uses TCP/IP sockets. Network traffic is
97                                handled via threads that handle inbound and
98                                outbound messages.  However, each
99                               process uses a single socket
100                               that is shared using <tt class="function">select()</tt>.
101                        </p>
102              <p>
103                                Note that for this reason, the replication framework is
104                                limited to a maximum of 60 replicas (on
105                                Windows) and approximately 1000 replicas (on
106                                Unix and related systems), depending on how
107                                your system is configured.
108                        </p>
109            </li>
110            <li>
111              <p>
112                            Requires a single process for the master replica.
113                        </p>
114            </li>
115            <li>
116              <p>
117                                    Requires that only one instance of the
118                                    environment handle be used.
119                            </p>
120            </li>
121            <li>
122              <p>
123                            Upon application startup, a master can be
124                            selected either manually or via elections.
125                            After startup time, however, during the course of 
126                            normal operations it is possible for the
127                            replication group to need to locate a new master (due
128                            to network or other hardware related problems,
129                            for example) and in this scenario elections are 
130                            always used to select the new master.
131                        </p>
132            </li>
133          </ul>
134        </div>
135        <p>
136                    If your application has technical requirements that do
137                    not conform to the implementation provided by the
138                    replication framework, you must write a custom
139                    replication framework using the DB replication APIs
140                    directly. See the next section for introductory
141                    details.
142                </p>
143      </div>
144      <div class="sect2" lang="en" xml:lang="en">
145        <div class="titlepage">
146          <div>
147            <div>
148              <h3 class="title"><a id="repapioverview"></a>Replication API Overview</h3>
149            </div>
150          </div>
151          <div></div>
152        </div>
153        <p>
154                    The replication API is a series of Berkeley DB library
155                    classes and methods that you can use to build your own
156                    replication infrastructure. You should use the
157                    replication API only if the replication framework does not meet your
158                    application's technical requirements.
159                </p>
160        <p>
161                    To make use of the replication API, you must write your
162                    own networking code. This frees you from the technical
163                    constraints imposed by the replication framework. For example, by
164                    writing your own framework, you can:
165                </p>
166        <div class="itemizedlist">
167          <ul type="disc">
168            <li>
169              <p>
170                                        Use a threading package other than
171                                        pthreads (Unix) or Windows threads
172                                        (Microsoft Windows). This might be interesting
173                                        to you if you are using a platform
174                                        whose preferred threading package
175                                        is something other than (for
176                                        example) pthreads, such as is the case for 
177                                        Sun Microsystem's Solaris operating systems.
178                                </p>
179            </li>
180            <li>
181              <p>
182                                        Implement your own sockets. The
183                                        replication framework uses TCP/IP sockets. While
184                                        this should be acceptable for the
185                                        majority of applications, sometimes
186                                        UDP or even raw sockets might be
187                                        desired.
188                                </p>
189            </li>
190            <li>
191              <p>
192                                        Write a multi-process master
193                                        replica. 
194                                </p>
195            </li>
196          </ul>
197        </div>
198        <p>
199                        For information on writing a replicated application
200                        using the Berkeley DB replication APIs, see the
201                        <i class="citetitle">Berkeley DB Programmer's Reference Guide</i>.
202                </p>
203      </div>
204    </div>
205    <div class="navfooter">
206      <hr />
207      <table width="100%" summary="Navigation footer">
208        <tr>
209          <td width="40%" align="left"><a accesskey="p" href="repadvantage.html">Prev</a>��</td>
210          <td width="20%" align="center">
211            <a accesskey="u" href="introduction.html">Up</a>
212          </td>
213          <td width="40%" align="right">��<a accesskey="n" href="elections.html">Next</a></td>
214        </tr>
215        <tr>
216          <td width="40%" align="left" valign="top">Replication Benefits��</td>
217          <td width="20%" align="center">
218            <a accesskey="h" href="index.html">Home</a>
219          </td>
220          <td width="40%" align="right" valign="top">��Holding Elections</td>
221        </tr>
222      </table>
223    </div>
224  </body>
225</html>
226