1 |
878
|
berkley
|
<!--
|
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. The replication scheme that Metacat uses is
|
31 |
|
|
both push and pull. There are several triggers that can start a replication
|
32 |
|
|
mechanism. </p>
|
33 |
|
|
<ul>
|
34 |
|
|
<li>Delta-T monitoring. At a set time interval a server checks each of the
|
35 |
|
|
other servers in its list for updated documents</li>
|
36 |
|
|
<li>INSERT trigger. Whenever a document is inserted, the server notifies
|
37 |
|
|
the remote hosts in its list that it has a new file available.</li>
|
38 |
|
|
<li>UPDATE trigger. Whenever a document is updated, the server notifies
|
39 |
|
|
each server in its list of the update.</li>
|
40 |
|
|
<li>File locking. When a local user tries to alter a document on a local
|
41 |
|
|
server that belongs to a remote server, the local server must first
|
42 |
|
|
obtain a lock on that file. Once the lock is obtained, the file can
|
43 |
|
|
be updated, then it is force replicated out to each server in the list.
|
44 |
|
|
The lock ensures that the remote copy is up to date and that an older
|
45 |
|
|
file does not overwrite a newer one. Only a documents home server
|
46 |
|
|
can give a lock for that file to be altered.</li>
|
47 |
|
|
</ul>
|
48 |
|
|
<p>Each server contains a list of servers to which it can replicate. One-way
|
49 |
|
|
replication is enabled by the 'replicate' flag in the list. The server list
|
50 |
|
|
may look like the following.</p>
|
51 |
|
|
<table border="1">
|
52 |
|
|
<tr>
|
53 |
|
|
<td><b>serverid</b></td>
|
54 |
|
|
<td><b>server</b></td>
|
55 |
|
|
<td><b>last_checked</b></td>
|
56 |
|
|
<td><b>replicate</b></td>
|
57 |
|
|
</tr>
|
58 |
|
|
<tr>
|
59 |
|
|
<td>1</td>
|
60 |
|
|
<td>localhost</td>
|
61 |
|
|
<td>null</td>
|
62 |
|
|
<td>0</td>
|
63 |
|
|
</tr>
|
64 |
|
|
<tr>
|
65 |
|
|
<td>2</td>
|
66 |
|
|
<td>alpha.nceas.ucsb.edu:8080/berkley/servlet/replication</td>
|
67 |
|
|
<td>2001-01-22 14:52:12.1</td>
|
68 |
|
|
<td>1</td>
|
69 |
|
|
</tr>
|
70 |
|
|
<tr>
|
71 |
|
|
<td>3</td>
|
72 |
|
|
<td>dev.nceas.ucsb.edu/Metacat/servlet/replication</td>
|
73 |
|
|
<td>2001-01-23 9:10:02.5</td>
|
74 |
|
|
<td>1</td>
|
75 |
|
|
</tr>
|
76 |
|
|
</table>
|
77 |
|
|
|
78 |
|
|
<p>The server list is kept in a table in the database called xml_replication.
|
79 |
|
|
Localhost must always be the first entry in the table and have a serverid of 1.
|
80 |
|
|
The server field must always point to the other server's replication servlet,
|
81 |
|
|
hence the servlet/replication on the end of both of the sample servers. Note
|
82 |
|
|
that any port numbers (if your servlet engine is not running on port 80) must
|
83 |
|
|
also be included. The replicate flag is set to 1 if you want this server to
|
84 |
|
|
copy data TO the remote host. (Note that both servers (the local host and
|
85 |
|
|
the remote host) must have each other in their respective tables or replication
|
86 |
|
|
will not take place.)</p>
|
87 |
|
|
<b>Example:</b>
|
88 |
|
|
<table border="1">
|
89 |
|
|
<tr>
|
90 |
|
|
<td>host</td>
|
91 |
|
|
<td>replication table</td>
|
92 |
|
|
</tr>
|
93 |
|
|
<tr>
|
94 |
|
|
<td>snoopy.nceas.ucsb.edu</td>
|
95 |
|
|
<td>
|
96 |
|
|
<table border="2">
|
97 |
|
|
<tr>
|
98 |
|
|
<td><b>server</b></td>
|
99 |
|
|
<td><b>last_checked</b></td>
|
100 |
|
|
<td><b>replicate</b></td>
|
101 |
|
|
</tr>
|
102 |
|
|
<tr>
|
103 |
|
|
<td>localhost</td>
|
104 |
|
|
<td>null</td>
|
105 |
|
|
<td>0</td>
|
106 |
|
|
</tr>
|
107 |
|
|
<tr>
|
108 |
|
|
<td>alpha.nceas.ucsb.edu:8080/berkley/servlet/replication </td>
|
109 |
|
|
<td>2001-01-22 14:52:12.1</td>
|
110 |
|
|
<td>1</td>
|
111 |
|
|
</tr>
|
112 |
|
|
<tr>
|
113 |
|
|
<td>dev.nceas.ucsb.edu/Metacat/servlet/replication</td>
|
114 |
|
|
<td>2001-01-23 9:10:02.5</td>
|
115 |
|
|
<td>1</td>
|
116 |
|
|
</tr>
|
117 |
|
|
</table>
|
118 |
|
|
</td>
|
119 |
|
|
</tr>
|
120 |
|
|
<tr>
|
121 |
|
|
<td>alpha.nceas.ucsb.edu</td>
|
122 |
|
|
<td>
|
123 |
|
|
<table border="2">
|
124 |
|
|
<tr>
|
125 |
|
|
<td><b>server</b></td>
|
126 |
|
|
<td><b>last_checked</b></td>
|
127 |
|
|
<td><b>replicate</b></td>
|
128 |
|
|
</tr>
|
129 |
|
|
<tr>
|
130 |
|
|
<td>localhost</td>
|
131 |
|
|
<td>null</td>
|
132 |
|
|
<td>0</td>
|
133 |
|
|
</tr>
|
134 |
|
|
<tr>
|
135 |
|
|
<td>snoopy.nceas.ucsb.edu:8080/berkley/servlet/replication</td>
|
136 |
|
|
<td>2001-01-21 11:33:12.7</td>
|
137 |
|
|
<td>0</td>
|
138 |
|
|
</tr>
|
139 |
|
|
<tr>
|
140 |
|
|
<td>dev.nceas.ucsb.edu/Metacat/servlet/replication</td>
|
141 |
|
|
<td>2001-01-23 10:22:02.5</td>
|
142 |
|
|
<td>1</td>
|
143 |
|
|
</tr>
|
144 |
|
|
</table>
|
145 |
|
|
</td>
|
146 |
|
|
</tr>
|
147 |
|
|
<tr>
|
148 |
|
|
<td>dev.nceas.ucsb.edu</td>
|
149 |
|
|
<td>
|
150 |
|
|
<table border="2">
|
151 |
|
|
<tr>
|
152 |
|
|
<td><b>server</b></td>
|
153 |
|
|
<td><b>last_checked</b></td>
|
154 |
|
|
<td><b>replicate</b></td>
|
155 |
|
|
</tr>
|
156 |
|
|
<tr>
|
157 |
|
|
<td>localhost</td>
|
158 |
|
|
<td>null</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 |
|
|
</tr>
|
166 |
|
|
<tr>
|
167 |
|
|
<td>alpha.nceas.ucsb.edu:8080/Metacat/servlet/replication</td>
|
168 |
|
|
<td>2001-01-22 12:15:32.5</td>
|
169 |
|
|
<td>1</td>
|
170 |
|
|
</tr>
|
171 |
|
|
</table>
|
172 |
|
|
</td>
|
173 |
|
|
</tr>
|
174 |
|
|
</table>
|
175 |
|
|
<p>Our three servers, snoopy, alpha and dev are all set up to replicate
|
176 |
|
|
between themselves. Snoopy is a one way replicator. Meaning that it only
|
177 |
|
|
pushes data to alpha and dev but does not pull back from them. This
|
178 |
|
|
is achieved by dev and alpha setting snoopy's 'replicate' value to 0 indicating
|
179 |
|
|
that they do not want to send their files to snoopy. Alpha and dev have a
|
180 |
|
|
two-way replication agreement since each of them have a 1 in their 'replicate'
|
181 |
|
|
value for the other.</p>
|
182 |
|
|
<p>There is an html control panel for controling replication. After
|
183 |
|
|
<a href="./Metacatinstall.html">installing</a> Metacat, you can access
|
184 |
|
|
it by going through the Metacat servlet context you have setup and calling up
|
185 |
|
|
replControl.html. For instance, if you setup a Metacat servlet instance
|
186 |
|
|
called 'Metacat' you would probably type
|
187 |
|
|
http://server.domain.com:8080/Metacat/replControl.html. The control panel
|
188 |
|
|
is an easy interface for adding/removing/altering servers and starting the
|
189 |
|
|
delta-T handler. It will also allow you to 'force replicate' your server list.
|
190 |
|
|
This is useful if you want to initialize the state of one Metacat server
|
191 |
|
|
from an existing state of another (i.e. copy all of the data from an existing
|
192 |
|
|
server).</p>
|
193 |
|
|
|
194 |
|
|
<br>
|
195 |
|
|
<a href="./packages.html">Back</a> | <a href="./metacattour.html">Home</a> |
|
196 |
|
|
<a href="./datafiles.html">Next</a>
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
</BODY>
|
200 |
|
|
</HTML>
|