Project

General

Profile

metacat / docs / user / replication.html @ 3067

1
<!--
2
  * replication.html
3
  *
4
  *      Authors: Chad Berkley
5
  *    Copyright: 2000 Regents of the University of California and the
6
  *               National Center for Ecological Analysis and Synthesis
7
  *  For Details: http://www.nceas.ucsb.edu/
8
  *      Created: 2001 January 23
9
  *      Version: 
10
  *    File Info: '$ '
11
  * 
12
  * 
13
-->
14
<HTML>
15
<HEAD>
16
<TITLE>Metacat</TITLE>
17
<link rel="stylesheet" type="text/css" href="@docrooturl@default.css">
18
</HEAD> 
19
<BODY>
20
  <table width="100%">
21
    <tr>
22
      <td class="tablehead" colspan="2"><p class="label">Replication</p></td>
23
      <td class="tablehead" colspan="2" align="right">
24
        <a href="./packages.html">Back</a> | <a href="./metacattour.html">Home</a> | 
25
        <a href="./datafiles.html">Next</a>
26
      </td>
27
    </tr>
28
  </table>
29
  <p>Metacat has built in replication to allow different Metacat servers to 
30
  share data between themselves. In this release, Metacat not only replicate 
31
  XML documents but also data files. </p>
32
  <p> A new hub feature was added to Metacat too. Previous version of Metacat
33
  only replicate XML documents whose home server is itself. But hub Metacat can 
34
  replicate both its documents and other's documents which replicated from 
35
  other server.</p>
36
  <p>The replication scheme that Metacat uses is both push and pull.  There are 
37
  several triggers that can start a replication mechanism. </p>
38
  <ul>
39
    <li>Delta-T monitoring. At a set time interval a server checks each of the
40
    other servers in its list for updated documents</li>
41
    <li>INSERT trigger. Whenever a document is inserted, the server notifies
42
    the remote hosts in its list that it has a new file available.</li>
43
    <li>UPDATE trigger. Whenever a document is updated, the server notifies
44
    each server in its list of the update.</li>
45
    <li>File locking. When a local user tries to alter a document on a local 
46
    server that belongs to a remote server, the local server must first
47
    obtain a lock on that file.  Once the lock is obtained, the file can 
48
    be updated, then it is force replicated out to each server in the list.
49
    The lock ensures that the remote copy is up to date and that an older
50
    file does not overwrite a newer one.  Only a documents home server
51
    can give a lock for that file to be altered.</li>
52
  </ul>
53
  <p>Each server contains a list of servers to which it can replicate.  One-way
54
  replication is enabled by the 'replicate' and 'datareplicate' flags in the 
55
  list.  The server list may look like the following.</p>
56
  <table border="1">
57
    <tr>
58
      <td><b>serverid</b></td>
59
      <td><b>server</b></td>
60
      <td><b>last_checked</b></td>
61
      <td><b>replicate</b></td>
62
      <td><b>datareplicate</b></td>
63
      <td><b>hub</b></td>
64
    </tr>
65
    <tr>
66
      <td>1</td>
67
      <td>localhost</td>
68
      <td>null</td>
69
      <td>0</td>
70
      <td>0</td>
71
      <td>0</td>
72
    </tr>
73
    <tr>
74
      <td>2</td>
75
      <td>alpha.nceas.ucsb.edu:8080/berkley/servlet/replication</td>
76
      <td>2001-01-22 14:52:12.1</td>
77
      <td>0</td>
78
      <td>0</td>
79
      <td>0</td>
80
    </tr>
81
    <tr>
82
      <td>3</td>
83
      <td>dev.nceas.ucsb.edu/Metacat/servlet/replication</td>
84
      <td>2001-01-23 9:10:02.5</td>
85
      <td>1</td>
86
      <td>1</td>
87
      <td>0</td>
88
    </tr>
89
  </table>
90
  
91
  <p>The server list is kept in a table in the database called xml_replication.
92
  Localhost must always be the first entry in the table and have a serverid of 1.
93
  The server field must always point to the other server's replication servlet,
94
  hence the servlet/replication on the end of both of the sample servers.  Note
95
  that any port numbers (if your servlet engine is not running on port 80) must
96
  also be included.  The replicate flag is set to 1 if you want this server to 
97
  copy XML documents TO the remote host.  If replicate flag is set to 1 and 
98
  datareplicate is set to 1, this server can copy data file TO the remote host
99
  too. If this server is a hub to the remote host, the hub flag should be set to
100
  1. (Note that both servers (the local host and the remote host) must have each 
101
  other in their respective tables or replication will not take place.)</p>
102
  <b>Example:</b>
103
  <table border="1">
104
    <tr>
105
      <td>host</td>
106
      <td>replication table</td>
107
    </tr>
108
    <tr>
109
     <td>snoopy.nceas.ucsb.edu</td>
110
     <td>
111
      <table border="2">
112
        <tr>
113
          <td><b>server</b></td>
114
          <td><b>last_checked</b></td>
115
          <td><b>replicate</b></td>
116
          <td><b>datareplicate</b></td>
117
          <td><b>hub</b></td>
118
        </tr>
119
        <tr>
120
          <td>localhost</td>
121
          <td>null</td>
122
          <td>0</td>
123
          <td>0</td>
124
          <td>0</td>
125
        </tr>
126
        <tr>
127
          <td>alpha.nceas.ucsb.edu:8080/berkley/servlet/replication&nbsp;&nbsp;&nbsp;</td>
128
          <td>2001-01-22 14:52:12.1</td>
129
          <td>0</td>
130
          <td>0</td>
131
          <td>0</td>
132
        </tr>
133
        <tr>
134
          <td>dev.nceas.ucsb.edu/Metacat/servlet/replication</td>
135
          <td>2001-01-23 9:10:02.5</td>
136
          <td>1</td>
137
          <td>1</td>
138
          <td>0</td>
139
        </tr>
140
      </table>
141
     </td>
142
    </tr>
143
    <tr>
144
      <td>alpha.nceas.ucsb.edu</td>
145
      <td>
146
        <table border="2">
147
          <tr>
148
            <td><b>server</b></td>
149
            <td><b>last_checked</b></td>
150
            <td><b>replicate</b></td>
151
            <td><b>datareplicate</b></td>
152
            <td><b>hub</b></td>
153
          </tr>
154
          <tr>
155
            <td>localhost</td>
156
            <td>null</td>
157
            <td>0</td>
158
            <td>0</td>
159
            <td>0</td>
160
          </tr>
161
          <tr>
162
            <td>snoopy.nceas.ucsb.edu:8080/berkley/servlet/replication</td>
163
            <td>2001-01-21 11:33:12.7</td>
164
            <td>0</td>
165
            <td>1</td>
166
            <td>0</td>
167
          </tr>
168
          <tr>
169
            <td>dev.nceas.ucsb.edu/Metacat/servlet/replication</td>
170
            <td>2001-01-23 10:22:02.5</td>
171
            <td>1</td>
172
            <td>0</td>
173
            <td>0</td>
174
          </tr>
175
        </table>
176
      </td>
177
    </tr>
178
    <tr>
179
      <td>dev.nceas.ucsb.edu</td>
180
      <td>
181
        <table border="2">
182
          <tr>
183
            <td><b>server</b></td>
184
            <td><b>last_checked</b></td>
185
            <td><b>replicate</b></td>
186
            <td><b>datareplicate</b></td>
187
            <td><b>hub</b></td>
188
          </tr>
189
          <tr>
190
            <td>localhost</td>
191
            <td>null</td>
192
            <td>0</td>
193
            <td>0</td>
194
            <td>0</td>
195
          </tr>
196
          <tr>
197
            <td>snoopy.nceas.ucsb.edu:8080/berkley/servlet/replication</td>
198
            <td>2001-01-21 11:33:12.7</td>
199
            <td>0</td>
200
            <td>0</td>
201
            <td>0</td>
202
          </tr>
203
          <tr>
204
            <td>alpha.nceas.ucsb.edu:8080/Metacat/servlet/replication</td>
205
            <td>2001-01-22 12:15:32.5</td>
206
            <td>1</td>
207
            <td>1</td>
208
            <td>1</td>
209
          </tr>
210
        </table>
211
      </td>
212
    </tr>
213
  </table>
214
  <p>Our three servers, snoopy, alpha and dev are all set up to replicate
215
  between themselves.  Snoopy is a one way replicator.  Meaning that it only 
216
  pushes XML documents and data file to dev but does not pull back from it.  This
217
  is achieved by dev and alpha setting snoopy's 'replicate' value to 0 indicating
218
  that they do not want to send their files to snoopy(Even in in Alpha, 
219
  'datareplicate' is set to 1 for snoopy but nothing will be sent to Snoopy from alpha).  
220
  Alpha and dev have a two-way replication agreement since each of them have a 1 
221
  in their 'replicate' value for the other.</p>
222
  <p>Snoopy will replicate both XML documents and data file to dev because it 
223
  setting dev's 'replicata' and 'datareplicate' is 1. Alpha only replicate
224
  XML documents to dev and this is caused by it setting dev's 'datareplicate' 0.
225
  </p>
226
  <p>Dev is a hub of alpha because it setting alpha's 'hub' value to be 1. Moreover, 
227
  dev set alpha's 'replicate' and 'datareplicate' value 1. So dev will replicate
228
  XML documents and data file whose home server is dev or snoopy(replicated 
229
  from snoopy) to alpha</p>
230
  <P>Note: if 'replicate' value is 0, the value for 'datareplicate' and 'hub'
231
  has no sense.</P>
232
  <p>There is an html control panel for controling replication.  After
233
  <a href="./Metacatinstall.html">installing</a> Metacat, you can access
234
  it by going through the Metacat servlet context you have setup and calling up
235
  replControl.html.  For instance, if you setup a Metacat servlet instance 
236
  called 'Metacat' you would probably type 
237
  http://server.domain.com:8080/Metacat/replControl.html.  The control panel 
238
  is an easy interface for adding/removing/altering servers and starting the 
239
  delta-T handler.  It will also allow you to 'force replicate' your server list.
240
  This is useful if you want to initialize the state of one Metacat server
241
  from an existing state of another (i.e. copy all of the data from an existing
242
  server).</p>
243
  
244
  <br>
245
  <a href="./packages.html">Back</a> | <a href="./metacattour.html">Home</a> | 
246
  <a href="./datafiles.html">Next</a>
247
  
248

    
249
</BODY>
250
</HTML>