| 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>Connecting to a new site</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_comm.html" title="Building the communications infrastructure" /> |
| 12 | <link rel="next" href="group_membership.html" title="Managing Replication Manager Group Membership" /> |
| 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">Connecting to a new site</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="rep_comm.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="group_membership.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_newsite"></a>Connecting to a new site</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <p>To add a new site to the replication group all that is needed |
| 42 | is for the client member to join. Berkeley DB will perform an |
| 43 | internal initialization from the master to the client automatically |
| 44 | and will run recovery on the client to bring it up to date |
| 45 | with the master.</p> |
| 46 | <p>For Base API applications, connecting to a |
| 47 | new site in the replication group happens whenever the |
| 48 | <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> method returns <a href="../api_reference/C/repmessage.html#repmsg_DB_REP_NEWSITE" class="olink">DB_REP_NEWSITE</a>. The application |
| 49 | should assign the new site a local environment ID number, and all future |
| 50 | messages from the site passed to <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> should include that |
| 51 | environment ID number. It is possible, of course, for the application |
| 52 | to be aware of a new site before the return of <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> (for |
| 53 | example, applications using connection-oriented protocols are likely to |
| 54 | detect new sites immediately, while applications using broadcast |
| 55 | protocols may not).</p> |
| 56 | <p>Regardless, in applications supporting the dynamic addition of database |
| 57 | environments to replication groups, environments joining an existing |
| 58 | replication group may need to provide contact information. (For |
| 59 | example, in an application using TCP/IP sockets, a DNS name or IP |
| 60 | address might be a reasonable value to provide.) This can be done using |
| 61 | the <span class="bold"><strong>cdata</strong></span> parameter to the <a href="../api_reference/C/repstart.html" class="olink">DB_ENV->rep_start()</a> method. The information |
| 62 | referenced by <span class="bold"><strong>cdata</strong></span> is wrapped in the initial contact message |
| 63 | sent by the new environment, and is provided to the existing members of |
| 64 | the group using the <span class="bold"><strong>rec</strong></span> parameter returned by <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a>. |
| 65 | If no additional information was provided for Berkeley DB to forward to the |
| 66 | existing members of the group, the <span class="bold"><strong>data</strong></span> field of the <span class="bold"><strong>rec</strong></span> |
| 67 | parameter passed to the <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> method will be NULL after |
| 68 | <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> returns <a href="../api_reference/C/repmessage.html#repmsg_DB_REP_NEWSITE" class="olink">DB_REP_NEWSITE</a>.</p> |
| 69 | <p>Replication Manager automatically distributes contact information |
| 70 | using the mechanisms previously described.</p> |
| 71 | </div> |
| 72 | <div class="navfooter"> |
| 73 | <hr /> |
| 74 | <table width="100%" summary="Navigation footer"> |
| 75 | <tr> |
| 76 | <td width="40%" align="left"><a accesskey="p" href="rep_comm.html">Prev</a> </td> |
| 77 | <td width="20%" align="center"> |
| 78 | <a accesskey="u" href="rep.html">Up</a> |
| 79 | </td> |
| 80 | <td width="40%" align="right"> <a accesskey="n" href="group_membership.html">Next</a></td> |
| 81 | </tr> |
| 82 | <tr> |
| 83 | <td width="40%" align="left" valign="top">Building the communications infrastructure </td> |
| 84 | <td width="20%" align="center"> |
| 85 | <a accesskey="h" href="index.html">Home</a> |
| 86 | </td> |
| 87 | <td width="40%" align="right" valign="top"> Managing Replication Manager Group Membership</td> |
| 88 | </tr> |
| 89 | </table> |
| 90 | </div> |
| 91 | </body> |
| 92 | </html> |