1<!--$Id: newsite.so,v 1.7 2006/08/24 17:58:53 bostic Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB Reference Guide: Connecting to a new site</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Berkeley DB Replication</dl></b></td> 13<td align=right><a href="../rep/comm.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../rep/elect.html"><img src="../../images/next.gif" alt="Next"></a> 14</td></tr></table> 15<p align=center><b>Connecting to a new site</b></p> 16<p>To add a new site to the replication group all that is needed 17is for the client member to join. Berkeley DB will perform an 18internal initialization from the master to the client automatically 19and will run recovery on the client to bring it up to date 20with the master.</p> 21<p>For applications that use the Base replication API, connecting to a 22new site in the replication group happens whenever the 23<a href="../../api_c/rep_message.html">DB_ENV->rep_process_message</a> method returns <a href="../../api_c/rep_message.html#DB_REP_NEWSITE">DB_REP_NEWSITE</a>. The application 24should assign the new site a local environment ID number, and all future 25messages from the site passed to <a href="../../api_c/rep_message.html">DB_ENV->rep_process_message</a> should include that 26environment ID number. It is possible, of course, for the application 27to be aware of a new site before the return of <a href="../../api_c/rep_message.html">DB_ENV->rep_process_message</a> (for 28example, applications using connection-oriented protocols are likely to 29detect new sites immediately, while applications using broadcast 30protocols may not).</p> 31<p>Regardless, in applications supporting the dynamic addition of database 32environments to replication groups, environments joining an existing 33replication group may need to provide contact information. (For 34example, in an application using TCP/IP sockets, a DNS name or IP 35address might be a reasonable value to provide.) This can be done using 36the <b>cdata</b> parameter to the <a href="../../api_c/rep_start.html">DB_ENV->rep_start</a> method. The information 37referenced by <b>cdata</b> is wrapped in the initial contact message 38sent by the new environment, and is provided to the existing members of 39the group using the <b>rec</b> parameter returned by <a href="../../api_c/rep_message.html">DB_ENV->rep_process_message</a>. 40If no additional information was provided for Berkeley DB to forward to the 41existing members of the group, the <b>data</b> field of the <b>rec</b> 42parameter passed to the <a href="../../api_c/rep_message.html">DB_ENV->rep_process_message</a> method will be NULL after 43<a href="../../api_c/rep_message.html">DB_ENV->rep_process_message</a> returns <a href="../../api_c/rep_message.html#DB_REP_NEWSITE">DB_REP_NEWSITE</a>.</p> 44<p>Replication Manager automatically distributes contact information using 45the mechanisms previously described.</p> 46<table width="100%"><tr><td><br></td><td align=right><a href="../rep/comm.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../rep/elect.html"><img src="../../images/next.gif" alt="Next"></a> 47</td></tr></table> 48<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 49</body> 50</html> 51