Debian Codegraph @

docs/programmer_reference/rep_mgr_meth.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>Replication Manager methods</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="rep_app.html" title="Building replicated applications" />
12 <link rel="next" href="rep_base_meth.html" title="Base API Methods" />
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">Replication Manager methods</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="rep_app.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_base_meth.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_mgr_meth"></a>Replication Manager methods</h2>
38 </div>
39 </div>
40 </div>
41 <p>
42 Applications which use the Replication Manager support generally
43 call the following Berkeley DB methods. The general pattern is to
44 call various methods to configure Replication Manager, and then
45 start it by calling <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a>. Once this initialization is
46 complete, the application rarely needs to call any of these
47 methods. (A prime example of an exception to this rule would be
48 the <a href="../api_reference/C/repsync.html" class="olink">DB_ENV-&gt;rep_sync()</a> method, if the application is
49 <a class="xref" href="rep_mastersync.html#rep_delay_sync" title="Delaying client synchronization">Delaying client synchronization</a>.)
50 </p>
51 <div class="variablelist">
52 <dl>
53 <dt>
54 <span class="term">
55 <a href="../api_reference/C/db_site.html" class="olink">DB_SITE</a>
56 </span>
57 </dt>
58 <dd>
59 <p>
60 The <a href="../api_reference/C/db_site.html" class="olink">DB_SITE</a> handle is used to configure a site that
61 belongs to the replication group. You can obtain a <a href="../api_reference/C/db_site.html" class="olink">DB_SITE</a>
62 handle by calling the <a href="../api_reference/C/repmgr_site.html" class="olink">DB_ENV-&gt;repmgr_site()</a> method. When you do this, you
63 provide the TCP/IP host name and port that the replication
64 site uses for incoming connections.
65 </p>
66 <p>
67 Once you have the <a href="../api_reference/C/db_site.html" class="olink">DB_SITE</a> handle, you use the
68 <a href="../api_reference/C/dbsite_set_config.html" class="olink">DB_SITE-&gt;set_config()</a> method to configure the handle. One of
69 the things you can configure about the handle is whether it
70 is the local site (using the <code class="literal">DB_LOCAL_SITE</code>
71 parameter). You must configure one and only one <a href="../api_reference/C/db_site.html" class="olink">DB_SITE</a> handle
72 to be a local site before you start replication.
73 </p>
74 <p>
75 You can also optionally configure <a href="../api_reference/C/db_site.html" class="olink">DB_SITE</a> handles for
76 remote sites to help Replication Manager startup more
77 efficiently. Note that it is usually not necessary for
78 each site in the replication group initially to know about
79 all other sites in the group. Sites can discover each
80 other dynamically, as described in
81 <a class="xref" href="rep_newsite.html" title="Connecting to a new site">Connecting to a new site</a>.
82 </p>
83 <p>
84 Once you have configured your <a href="../api_reference/C/db_site.html" class="olink">DB_SITE</a> handles, you start
85 replication using <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a>.
86 </p>
87 <p>
88 When you are shutting down your application, you must
89 use the <a href="../api_reference/C/dbsite_close.html" class="olink">DB_SITE-&gt;close()</a> method to close
90 all your open <a href="../api_reference/C/db_site.html" class="olink">DB_SITE</a> handles before you close your
91 environment handles.
92 </p>
93 </dd>
94 <dt>
95 <span class="term">
96 <a href="../api_reference/C/repmgrset_ack_policy.html" class="olink">DB_ENV-&gt;repmgr_set_ack_policy()</a>
97 </span>
98 </dt>
99 <dd>
100 <p>
101 The <a href="../api_reference/C/repmgrset_ack_policy.html" class="olink">DB_ENV-&gt;repmgr_set_ack_policy()</a> method configures the acknowledgement
102 policy to be used in the replication group, in other words, the
103 behavior of the master with respect to acknowledgements for
104 "permanent" messages, which implements the application's
105 requirements for <a class="xref" href="rep_trans.html" title="Transactional guarantees">Transactional guarantees</a>. The current implementation
106 requires all sites in the replication group to configure the same
107 acknowledgement policy.
108 </p>
109 </dd>
110 <dt>
111 <span class="term">
112 <a href="../api_reference/C/reppriority.html" class="olink">DB_ENV-&gt;rep_set_priority()</a>
113 </span>
114 </dt>
115 <dd>
116 <p>
117 The <a href="../api_reference/C/reppriority.html" class="olink">DB_ENV-&gt;rep_set_priority()</a> method configures the local site's priority
118 for the purpose of elections.
119 </p>
120 </dd>
121 <dt>
122 <span class="term">
123 <a href="../api_reference/C/repset_timeout.html" class="olink">DB_ENV-&gt;rep_set_timeout()</a>
124 </span>
125 </dt>
126 <dd>
127 <p>
128 This method optionally configures various timeout values.
129 Otherwise default timeout values as specified in <a href="../api_reference/C/repset_timeout.html" class="olink">DB_ENV-&gt;rep_set_timeout()</a>
130 are used. In particular, Replication Manager client sites can
131 be configured to monitor the health of the TCP/IP connection to
132 the master site using heartbeat messages. If the client
133 receives no messages from the master for a certain amount of
134 time, it considers the connection to be broken, and calls for
135 an election to choose a new master. Heartbeat messages
136 also help clients request missing master changes in the
137 absence of master activity.
138 </p>
139 </dd>
140 <dt>
141 <span class="term">
142 <a href="../api_reference/C/envevent_notify.html" class="olink">DB_ENV-&gt;set_event_notify()</a>
143 </span>
144 </dt>
145 <dd>
146 <p>
147 Once configured and started, Replication Manager does virtually
148 all of its work in the background, usually without the need for
149 any direct communication with the application. However,
150 occasionally events occur which the application may be
151 interested in knowing about. The application can request
152 notification of these events by calling the <a href="../api_reference/C/envevent_notify.html" class="olink">DB_ENV-&gt;set_event_notify()</a>
153 method.
154 </p>
155 </dd>
156 <dt>
157 <span class="term">
158 <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a>
159 </span>
160 </dt>
161 <dd>
162 <p>
163 The <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a> method starts the replication system. It
164 opens the listening TCP/IP socket and creates all the
165 background processing threads that will be needed.
166 </p>
167 </dd>
168 </dl>
169 </div>
170 <p>
171 In addition to the methods previously described, Replication Manager
172 applications may also call the following methods, as needed:
173 <a href="../api_reference/C/repconfig.html" class="olink">DB_ENV-&gt;rep_set_config()</a>, <a href="../api_reference/C/repset_limit.html" class="olink">DB_ENV-&gt;rep_set_limit()</a>, <a href="../api_reference/C/repset_request.html" class="olink">DB_ENV-&gt;rep_set_request()</a>, <a href="../api_reference/C/repsync.html" class="olink">DB_ENV-&gt;rep_sync()</a> and <a href="../api_reference/C/repstat.html" class="olink">DB_ENV-&gt;rep_stat()</a>.
174 </p>
175 <p>
176 Finally, Replication Manager applications can also make use of the
177 Replication Manager's message channels. This allows the various
178 sites in the replication group to pass messages that are tailored
179 to the application's requirements. For more information, see
180 <a class="xref" href="repmgr_channels.html" title="Using Replication Manager message channels">Using Replication Manager message channels</a>.
181 </p>
182 </div>
183 <div class="navfooter">
184 <hr />
185 <table width="100%" summary="Navigation footer">
186 <tr>
187 <td width="40%" align="left"><a accesskey="p" href="rep_app.html">Prev</a> </td>
188 <td width="20%" align="center">
189 <a accesskey="u" href="rep.html">Up</a>
190 </td>
191 <td width="40%" align="right"> <a accesskey="n" href="rep_base_meth.html">Next</a></td>
192 </tr>
193 <tr>
194 <td width="40%" align="left" valign="top">Building replicated applications </td>
195 <td width="20%" align="center">
196 <a accesskey="h" href="index.html">Home</a>
197 </td>
198 <td width="40%" align="right" valign="top"> Base API Methods</td>
199 </tr>
200 </table>
201 </div>
202 </body>
203 </html>