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>DB_ENV->rep_set_nsites()</title> 7 <link rel="stylesheet" href="apiReference.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 C API Reference" /> 10 <link rel="up" href="rep.html" title="Chapter 10. Replication Methods" /> 11 <link rel="prev" href="repset_limit.html" title="DB_ENV->rep_set_limit()" /> 12 <link rel="next" href="reppriority.html" title="DB_ENV->rep_set_priority()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DB_ENV->rep_set_nsites()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="repset_limit.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 10. 23 Replication Methods 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="reppriority.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="repnsites"></a>DB_ENV->rep_set_nsites()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->rep_set_nsites(DB_ENV *env, u_int32_t nsites); </pre> 42 <p> 43 The <code class="methodname">DB_ENV->rep_set_nsites()</code> method specifies the total number of 44 sites in a replication group. 45 </p> 46 <p> 47 The <code class="methodname">DB_ENV->rep_set_nsites()</code> method is typically called by 48 Replication Manager applications. (However, see also the 49 <a class="xref" href="repelect.html" title="DB_ENV->rep_elect()">DB_ENV->rep_elect()</a> method 50 <span class="bold"><strong>nsites</strong></span> 51 parameter.) 52 </p> 53 <p> 54 The database environment's replication subsystem may also be 55 configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 56 syntax of the entry in that file is a single line with the string 57 "rep_set_nsites", one or more whitespace characters, and the number of 58 sites specified. For example, "rep_set_nsites 5" sets the number of 59 sites to 5. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 60 read when the database environment is opened, it will silently 61 overrule configuration done before that time. 62 </p> 63 <p> 64 The <code class="methodname">DB_ENV->rep_set_nsites()</code> method configures a database 65 environment, not only operations performed using the specified 66 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle. 67 </p> 68 <p> 69 If master leases are in use, the <code class="methodname">DB_ENV->rep_set_nsites()</code> method 70 may not be called after the <a class="xref" href="repstart.html" title="DB_ENV->rep_start()">DB_ENV->rep_start()</a> or 71 <a class="xref" href="repmgrstart.html" title="DB_ENV->repmgr_start()">DB_ENV->repmgr_start()</a> methods 72 are called. If master leases are not in use, the 73 <code class="methodname">DB_ENV->rep_set_nsites()</code> method may be 74 called at any time during the life of the application. 75 </p> 76 <p> 77 The <code class="methodname">DB_ENV->rep_set_nsites()</code> <span> 78 <span> 79 method returns a non-zero error value on failure and 0 on success. 80 </span> 81 82 </span> 83 </p> 84 <div class="sect2" lang="en" xml:lang="en"> 85 <div class="titlepage"> 86 <div> 87 <div> 88 <h3 class="title"><a id="id1699284"></a>Parameters</h3> 89 </div> 90 </div> 91 </div> 92 <div class="sect3" lang="en" xml:lang="en"> 93 <div class="titlepage"> 94 <div> 95 <div> 96 <h4 class="title"><a id="id1699212"></a>nsites</h4> 97 </div> 98 </div> 99 </div> 100 <p> 101 An integer specifying the total number of sites in the replication 102 group. 103 </p> 104 </div> 105 </div> 106 <div class="sect2" lang="en" xml:lang="en"> 107 <div class="titlepage"> 108 <div> 109 <div> 110 <h3 class="title"><a id="id1699210"></a>Errors</h3> 111 </div> 112 </div> 113 </div> 114 <p> 115 The <code class="methodname">DB_ENV->rep_set_nsites()</code> <span> 116 <span> 117 method may fail and return one of the following non-zero errors: 118 </span> 119 120 </span> 121 </p> 122 <div class="sect3" lang="en" xml:lang="en"> 123 <div class="titlepage"> 124 <div> 125 <div> 126 <h4 class="title"><a id="id1698792"></a>EINVAL</h4> 127 </div> 128 </div> 129 </div> 130 <p> 131 If master leases are in use and replication has already been started; or if 132 an invalid flag value or parameter was specified. 133 </p> 134 </div> 135 </div> 136 <div class="sect2" lang="en" xml:lang="en"> 137 <div class="titlepage"> 138 <div> 139 <div> 140 <h3 class="title"><a id="id1699096"></a>Class</h3> 141 </div> 142 </div> 143 </div> 144 <p> 145 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> 146 </p> 147 </div> 148 <div class="sect2" lang="en" xml:lang="en"> 149 <div class="titlepage"> 150 <div> 151 <div> 152 <h3 class="title"><a id="id1699105"></a>See Also</h3> 153 </div> 154 </div> 155 </div> 156 <p> 157 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 158 </p> 159 </div> 160 </div> 161 <div class="navfooter"> 162 <hr /> 163 <table width="100%" summary="Navigation footer"> 164 <tr> 165 <td width="40%" align="left"><a accesskey="p" href="repset_limit.html">Prev</a> </td> 166 <td width="20%" align="center"> 167 <a accesskey="u" href="rep.html">Up</a> 168 </td> 169 <td width="40%" align="right"> <a accesskey="n" href="reppriority.html">Next</a></td> 170 </tr> 171 <tr> 172 <td width="40%" align="left" valign="top">DB_ENV->rep_set_limit() </td> 173 <td width="20%" align="center"> 174 <a accesskey="h" href="index.html">Home</a> 175 </td> 176 <td width="40%" align="right" valign="top"> DB_ENV->rep_set_priority()</td> 177 </tr> 178 </table> 179 </div> 180 </body> 181</html> 182