geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v3.0 > JMS clustering in Geronimo
Date Fri, 15 Jul 2011 03:57:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/4/_/styles/combined.css?spaceKey=GMOxDOC30&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/JMS+clustering+in+Geronimo">JMS
clustering in Geronimo</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~chirunhua@gmail.com">Runhua
Chi</a>
    </h4>
        <br/>
                         <h4>Changes (5)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>There are different kinds
of Master/Slave configurations available according to ActiveMQ documentation: <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{toc:maxlevel=1}
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">*
[Pure Master Slave|#Pure Master Slave] <br>* [Shared File System|#Shared File System]
<br>* [JDBC Master Slave|#JDBC Master Slave] <br></td></tr>
            <tr><td class="diff-unchanged" > <br>In Geronimo server, all
those configurations are handled using blueprint services. You need to update the content
of {{activemq.xml}} within {{activemq-broker-blueprint-3.0.car}} under {{/repository/org/apache/geronimo/configs/activemq-broker-blueprint/3.0}}
directory in accordance with the scenario you choose. The easier way would be to unzip {{activemq-broker-blueprint-3.0.car}}
and repack them after modification. <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >See the following configuration for
each scenario in Geronimo <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h2.
Pure Master/Slave <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h2.
Pure Master Slave <br></td></tr>
            <tr><td class="diff-unchanged" >With this scenario, you must specify
the master and slave node explicitly and manually restart a failed master. <br>h3. Master
node <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >h2. Shared File <span class="diff-changed-words"><span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">s</span><span
class="diff-added-chars"style="background-color: #dfd;">S</span>ystem</span>
<br></td></tr>
            <tr><td class="diff-unchanged" >In this scenario, you must use a shared
file system to provide high availability of brokers and automatic discovery of master/slave
nodes. The shared folder must allow different slaves to have _write_ permission. <br>h3.
Each node <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/GMOxDOC30/Farming+using+Deployment"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/GMOxDOC30/Farming+using+Deployment">Farming
using Deployment</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/GMOxDOC30/Clustering+and+farming"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/GMOxDOC30/Clustering+and+farming">Clustering and farming</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/GMOxDOC30/Plugin+based+Farming">Plugin
based Farming</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/GMOxDOC30/Plugin+based+Farming"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>

<p>JMS clustering in Geronimo is handled by ActiveMQ component using blueprint services.
you can configure brokers to be clustered, and a JMS request can failover to another broker
if the JMS broker goes down using <a href="http://activemq.apache.org/masterslave.html"
title="Master Slave" class="external-link" rel="nofollow">Master Slave</a> functionality.
</p>

<h1><a name="JMSclusteringinGeronimo-Prerequisite"></a>Prerequisite</h1>

<p>Make sure the system module <tt>org/apache/geronimo/activemq-ra/3.0/car</tt>
is loaded during server startup. And then update <tt>config-substitutions.properties</tt>
file under the <tt>/var/config</tt> directory to specify IP address or host name
for each ActiveMQ node when the server is stopped.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>config-substitutions.properties</b></div><div
class="codeContent panelContent">
<pre class="code-xml">
ActiveMQHostname=hostname/IP
</pre>
</div></div>


<h1><a name="JMSclusteringinGeronimo-JMSclusteringscenarios"></a>JMS clustering
scenarios</h1>

<p>There are different kinds of Master/Slave configurations available according to ActiveMQ
documentation:</p>
<ul>
	<li><a href="#JMSclusteringinGeronimo-PureMasterSlave">Pure Master Slave</a></li>
	<li><a href="#JMSclusteringinGeronimo-SharedFileSystem">Shared File System</a></li>
	<li><a href="#JMSclusteringinGeronimo-JDBCMasterSlave">JDBC Master Slave</a></li>
</ul>


<p>In Geronimo server, all those configurations are handled using blueprint services.
You need to update the content of <tt>activemq.xml</tt> within <tt>activemq-broker-blueprint-3.0.car</tt>
under <tt>/repository/org/apache/geronimo/configs/activemq-broker-blueprint/3.0</tt>
directory in accordance with the scenario you choose. The easier way would be to unzip <tt>activemq-broker-blueprint-3.0.car</tt>
and repack them after modification.</p>


<p>See the following configuration for each scenario in Geronimo</p>

<h2><a name="JMSclusteringinGeronimo-PureMasterSlave"></a>Pure Master Slave</h2>
<p>With this scenario, you must specify the master and slave node explicitly and manually
restart a failed master.</p>
<h3><a name="JMSclusteringinGeronimo-Masternode"></a>Master node</h3>
<p>On the master node, you just need to specify that the current node is a master by
using the <em>brokerName</em> attribute as follows.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>activemq.xml</b></div><div class="codeContent
panelContent">
<pre class="code-xml">
...
       <span class="code-tag">&lt;cm:property name=<span class="code-quote">"serverHostname"</span>
value=<span class="code-quote">"masterIP"</span>/&gt;</span>
...
</pre>
</div></div>
<h3><a name="JMSclusteringinGeronimo-Slavenode"></a>Slave node</h3>
<p>Because each master has only one slave in the Pure Master/Slave scenario, the slave
node must know the URI of the master node and also be tagged as a slave node by using the
<em>brokerName</em> attribute.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>activemq.xml</b></div><div class="codeContent
panelContent">
<pre class="code-xml">
...
       <span class="code-tag">&lt;cm:property name=<span class="code-quote">"serverHostname"</span>
value=<span class="code-quote">"slaveIP"</span>/&gt;</span>
...
</pre>
</div></div>

<h3><a name="JMSclusteringinGeronimo-Clientconnection"></a>Client connection</h3>
<p>JMS clients use the failover:// protocol to locate brokers in a cluster. See the
following example:</p>
<div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>failover://(tcp://masterIP:61616,tcp://slaveIP:61616)?randomize=false</p>
</div></div>


<h2><a name="JMSclusteringinGeronimo-SharedFileSystem"></a>Shared File System</h2>
<p>In this scenario, you must use a shared file system to provide high availability
of brokers and automatic discovery of master/slave nodes. The shared folder must allow different
slaves to have <em>write</em> permission.</p>
<h3><a name="JMSclusteringinGeronimo-Eachnode"></a>Each node</h3>
<p>On each node, configure a shared directory as the place where brokers are using the
<tt>persistenceAdapter</tt> element as follows:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>activemq.xml</b></div><div class="codeContent
panelContent">
<pre class="code-java">
...
       &lt;cm:property name=<span class="code-quote">"serverHostname"</span>
value=<span class="code-quote">"broker1"</span>/&gt;
...
       &lt;amq:persistenceAdapter&gt;
            &lt;amq:amqPersistenceAdapter directory=<span class="code-quote">"/sharedFileSystem/sharedBrokerData"</span>/&gt;
       &lt;/amq:persistenceAdapter&gt;
...
</pre>
</div></div>
<p>Note that:</p>
<ul>
	<li>For the shared file system on a Linux node, you must mount the shared directory
first.</li>
	<li>For the shared file system on a Windows node, you can use the path such as <tt>//ipAddress/sharedFolder</tt>
in the configuration.</li>
	<li>On each node, <em>broker1</em> should be replaced with the exact IP
address of current node.</li>
</ul>


<h3><a name="JMSclusteringinGeronimo-Clientconnection"></a>Client connection</h3>
<p>JMS clients use the failover:// protocol to locate brokers in a cluster. See the
following example:</p>
<div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>failover://(tcp://broker1:61616,tcp://broker2:61616,tcp://broker3:61616)?randomize=false</p>
</div></div>

<h2><a name="JMSclusteringinGeronimo-JDBCMasterSlave"></a>JDBC Master Slave</h2>
<p>In this scenario, you must use a shared database as the persistence enginee and automatic
recovery.</p>
<h3><a name="JMSclusteringinGeronimo-Eachnode"></a>Each node</h3>
<p>On each node, configure a shared database pool by using the <tt>jdbcPersistenceAdapter</tt>
element as follows. We use a remote Oracle database server as an example:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>activemq.xml</b></div><div class="codeContent
panelContent">
<pre class="code-java">
...
     &lt;cm:property name=<span class="code-quote">"serverHostname"</span>
value=<span class="code-quote">"broker1"</span>/&gt;
...
     &lt;amq:persistenceAdapter&gt;
         &lt;amq:jdbcPersistenceAdapter dataSource=<span class="code-quote">"#oracle-ds"</span>/&gt;
     &lt;/amq:persistenceAdapter&gt;
...
     &lt;bean id=<span class="code-quote">"oracle-ds"</span> class=<span
class="code-quote">"org.apache.commons.dbcp.BasicDataSource"</span> destroy-method=<span
class="code-quote">"close"</span>&gt;
      &lt;property name=<span class="code-quote">"driverClassName"</span>
value=<span class="code-quote">"oracle.jdbc.driver.OracleDriver"</span>/&gt;
      &lt;property name=<span class="code-quote">"url"</span> value=<span
class="code-quote">"jdbc:oracle:thin:@dbServer:1521:AMQDB"</span>/&gt;
      &lt;property name=<span class="code-quote">"username"</span> value=<span
class="code-quote">"scott"</span>/&gt;
      &lt;property name=<span class="code-quote">"password"</span> value=<span
class="code-quote">"tiger"</span>/&gt;
      &lt;property name=<span class="code-quote">"maxActive"</span> value=<span
class="code-quote">"200"</span>/&gt;
      &lt;property name=<span class="code-quote">"poolPreparedStatements"</span>
value=<span class="code-quote">"<span class="code-keyword">true</span>"</span>/&gt;
    &lt;/bean&gt;
...
</pre>
</div></div>
<p>Note that:</p>
<ul>
	<li>For the database server, <em>dbServer</em> should be replaced with
actual IP address of the database server.</li>
	<li>On each node, <em>broker1</em> should be replaced with the exact IP
address of current node.</li>
</ul>


<h3><a name="JMSclusteringinGeronimo-Clientconnection"></a>Client connection</h3>
<p>JMS clients use the failover:// protocol to locate brokers in a cluster. See the
following example: </p>
<div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>failover://(tcp://broker1:61616,tcp://broker2:61616,tcp://broker3:61616)?randomize=false</p>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/JMS+clustering+in+Geronimo">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=23334725&revisedVersion=4&originalVersion=3">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/JMS+clustering+in+Geronimo?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message