je/docs/ReplicationGuide/repexample.html

128 lines
6.3 KiB
HTML
Raw Permalink Normal View History

2021-06-06 17:46:45 +00:00
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Chapter 6. Replication Examples</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Getting Started with Berkeley DB, Java Edition High Availability Applications" />
<link rel="up" href="index.html" title="Getting Started with Berkeley DB, Java Edition High Availability Applications" />
<link rel="prev" href="events.html" title="Listening for Events" />
<link rel="next" href="administration.html" title="Chapter 7. Administration" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 12.2.7.5</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Chapter 6. Replication Examples</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="events.html">Prev</a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="administration.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="chapter" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="repexample"></a>Chapter 6. Replication Examples</h2>
</div>
</div>
</div>
<p>
JE HA provides three different example programs that illustrate
the concepts discussed in this manual. You can find them in your
JE distribution in the
<code class="literal">&lt;JE HOME&gt;/examples/je/rep/quote</code> directory,
where &lt;JE HOME&gt; is the directory where you
installed your JE distribution.
</p>
<p>
The examples provided for you are each based on a mock stock ticker
application which stores stock values in a replicated JE
environment. The differences in the three examples have to do with
how each example handles requests for database access; in
particular, database write requests.
</p>
<p>
Briefly, each of the examples are:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
<a class="ulink" href="../examples/je/rep/quote/StockQuotes.html" target="_top">StockQuotes</a>: Illustrates the most basic demonstration of
a replicated application. It is intended to help you gain
an understanding of basic HA concepts. It demonstrates use
of the HA APIs to create a replicated environment and issue
read and write transactions.
</p>
<p>
For this example, no attempt is made to route or forward
write requests. Instead, the application blindly attempts
any write requests that are made at the node. If the node
is in the Replica state, a <a class="ulink" href="../java/com/sleepycat/je/rep/ReplicaWriteException.html" target="_top">ReplicaWriteException</a> is
raised by the underlying HA code. The example then informs
you of the problem by way of rejecting the operation.
</p>
</li>
<li>
<p>
<a class="ulink" href="../examples/je/rep/quote/RouterDrivenStockQuotes.html" target="_top">RouterDrivenStockQuotes</a> and <a class="ulink" href="../examples/je/rep/quote/HARouter.html" target="_top">HARouter</a>: Illustrates
how a software load balancer might be integrated with
JE HA, where <a class="ulink" href="../examples/je/rep/quote/HARouter.html" target="_top">HARouter</a> plays the role of the load
balancer for purposes of the example. It does this by
using the <a class="ulink" href="../java/com/sleepycat/je/rep/monitor/Monitor.html" target="_top">Monitor</a> class to direct application
requests to the appropriate node. Read-only requests
are sent to Replicas, while read-write requests are sent
to the replication group's Master.
</p>
</li>
<li>
<p>
<a class="ulink" href="../examples/je/rep/quote/UpdateForwardingStockQuotes.html" target="_top">UpdateForwardingStockQuotes</a> and <a class="ulink" href="../examples/je/rep/quote/SimpleRouter.html" target="_top">SimpleRouter</a>:
Illustrates the use of an HA unaware router that load
balances read and write requests across the nodes in a
replication group. The router is implemented in
<a class="ulink" href="../examples/je/rep/quote/SimpleRouter.html" target="_top">SimpleRouter</a>, and is meant to illustrate how a load
balancer appliance might fit into the JE HA
architecture.
</p>
<p>
This example is based on <a class="ulink" href="../examples/je/rep/quote/RouterDrivenStockQuotes.html" target="_top">RouterDrivenStockQuotes</a>.
</p>
</li>
</ul>
</div>
<p>
Usage of each of these examples is described in the Javadoc page
for each example.
</p>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="events.html">Prev</a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="administration.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Listening for Events </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Chapter 7. Administration</td>
</tr>
</table>
</div>
</body>
</html>