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