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="rep_mgrmulti.html" title="Running Replication Manager in multiple processes" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Connecting to a new site</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="rep_comm.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��12.�� 23 Berkeley DB Replication 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="rep_mgrmulti.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="rep_newsite"></a>Connecting to a new site</h2> 35 </div> 36 </div> 37 </div> 38 <p>To add a new site to the replication group all that is needed 39is for the client member to join. Berkeley DB will perform an 40internal initialization from the master to the client automatically 41and will run recovery on the client to bring it up to date 42with the master.</p> 43 <p>For Base API applications, connecting to a 44new site in the replication group happens whenever the 45<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 46should assign the new site a local environment ID number, and all future 47messages from the site passed to <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> should include that 48environment ID number. It is possible, of course, for the application 49to 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 50example, applications using connection-oriented protocols are likely to 51detect new sites immediately, while applications using broadcast 52protocols may not).</p> 53 <p>Regardless, in applications supporting the dynamic addition of database 54environments to replication groups, environments joining an existing 55replication group may need to provide contact information. (For 56example, in an application using TCP/IP sockets, a DNS name or IP 57address might be a reasonable value to provide.) This can be done using 58the <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 59referenced by <span class="bold"><strong>cdata</strong></span> is wrapped in the initial contact message 60sent by the new environment, and is provided to the existing members of 61the 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>. 62If no additional information was provided for Berkeley DB to forward to the 63existing members of the group, the <span class="bold"><strong>data</strong></span> field of the <span class="bold"><strong>rec</strong></span> 64parameter passed to the <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> method will be NULL after 65<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> 66 <p>Replication Manager automatically distributes contact information 67using the mechanisms previously described.</p> 68 </div> 69 <div class="navfooter"> 70 <hr /> 71 <table width="100%" summary="Navigation footer"> 72 <tr> 73 <td width="40%" align="left"><a accesskey="p" href="rep_comm.html">Prev</a>��</td> 74 <td width="20%" align="center"> 75 <a accesskey="u" href="rep.html">Up</a> 76 </td> 77 <td width="40%" align="right">��<a accesskey="n" href="rep_mgrmulti.html">Next</a></td> 78 </tr> 79 <tr> 80 <td width="40%" align="left" valign="top">Building the communications infrastructure��</td> 81 <td width="20%" align="center"> 82 <a accesskey="h" href="index.html">Home</a> 83 </td> 84 <td width="40%" align="right" valign="top">��Running Replication Manager in multiple processes</td> 85 </tr> 86 </table> 87 </div> 88 </body> 89</html> 90