📄 ch13s144.html
字号:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Clustering in JBoss 3.0 alpha</title><link rel="stylesheet" href="styles.css" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/styles.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets Vimages/callouts/"><link rel="home" href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html" title="JBoss 3.0 Documentation"><link rel="up" href="ch13.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13.html" title="Chapter 13. HOWTO"><link rel="previous" href="ch13s135.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s135.html" title="Configuring and Using JAXP 1.1 In JBoss"><link rel="next" href="ch14.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch14.html" title="Chapter 14. Third Party Examples"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table border="0" cellpadding="0" cellspacing="0" height="65"><tr height="65"><td rowspan="2"><img src="jboss.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/jboss.gif" border="0"></td><td rowspan="2" background="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="100%" align="right" valign="top"><a href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html"><img src="doc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/doc.gif" border="0"></a><a href="ch13.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch13s135.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s135.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch14.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch14.html"><img src="next.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/next.gif" border="0"></a></td></tr><tr></tr></table><div class="section"><a name="clustering"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="clustering"></a>Clustering in JBoss 3.0 alpha</h2></div></div><p>Authors:
<span class="author">Sacha Labourey</span>
<tt><<a href="mailto:sacha.labourey@cogito-info.ch">sacha.labourey@cogito-info.ch</a>></tt>
<span class="author">Bill Burke</span>
<tt><<a href="mailto:bill@burkecentral.com">bill@burkecentral.com</a>></tt>
</p><div class="section"><a name="d0e12007"></a><div class="titlepage"><div><h3 class="title"><a name="d0e12007"></a>Introduction</h3></div></div><div class="section"><a name="d0e12010"></a><div class="titlepage"><div><h4 class="title"><a name="d0e12010"></a>What this article is about</h4></div></div><p>This document introduces basic clustering setup for Entity Beans, Stateful Session Beans and Stateless Session Beans. More advanced documentation will soon be available.</p><p>Clustering should be considered in alpha state. Feedback is highly welcome.</p><p>Clustering is built on top of the <a href="javascript:if(confirm('http://www.javagroups.com/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.javagroups.com/'" tppabs="http://www.javagroups.com/" target="_top">JavaGroups</a> framework and requires JDK 1.3.x.</p><p>In order to create a cluster of JBoss nodes, you simply need to launch several JBoss (with clustering activated, see below) instances on different hosts. JBoss instances will automatically detect their neighbors and form a cluster.</p></div></div><div class="section"><a name="d0e12024"></a><div class="titlepage"><div><h3 class="title"><a name="d0e12024"></a>General setup</h3></div></div><div class="section"><a name="d0e12027"></a><div class="titlepage"></div><p>Clustering features are available in the pre 3.0 sources. First get the latest sources from CVS or download one of the sources daily snapshot. You then need to build JBoss server (run jboss-all/build/build.bat or jboss-all/build/build.sh). For more information read this <a href="ch01s08.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01s08.html" title="Downloading the Documentation Example Source">the section called “Downloading the Documentation Example Source”</a>. </p><p>The resulting JBoss server can be found in jboss-all/build/output/jboss-3.0.0alpha.</p><p>To activate global clustering support, you need to copy the file jboss-all/cluster/etc/cluster-service.xml in the /deploy directory of your newly built JBoss server. Clustering is now activated in your JBoss server.</p></div></div><div class="section"><a name="d0e12036"></a><div class="titlepage"><div><h3 class="title"><a name="d0e12036"></a>Stateless Session Beans</h3></div></div><div class="section"><a name="d0e12039"></a><div class="titlepage"></div><p>To make a Stateless Session Bean (SLSB) active in a cluster, you need to modify its deployment settings in jboss.xml:</p><p><pre class="programlisting">
<jboss>
<enterprise-beans>
<session>
<ejb-name>nextgen.StatelessSession</ejb-name>
<jndi-name>nextget.StatelessSession</jndi-name>
<clustered>True</clustered>
</session>
</enterprise-beans>
</jboss>
</pre></p><p>Thus, you simply need to add the <clustered> tag to your existing jboss.xml configuration file.</p></div></div><div class="section"><a name="d0e12047"></a><div class="titlepage"><div><h3 class="title"><a name="d0e12047"></a>Stateful Session Beans</h3></div></div><div class="section"><a name="d0e12050"></a><div class="titlepage"></div><p>To make a Stateful Session Bean (SFSB) active in a cluster, you need to modify its deployment settings in jboss.xml:</p><p><pre class="programlisting">
<jboss>
<enterprise-beans>
<session>
<ejb-name>nextgen.StatefulSession</ejb-name>
<jndi-name>nextget.StatefulSession</jndi-name>
<clustered>True</clustered>
</session>
</enterprise-beans>
</jboss>
</pre></p><p>Thus, like for SLSB, you simply need to add the <clustered> tag to your existing jboss.xml configuration file. By default, bean state is replicated in-memory in sub-groups of two nodes.</p></div></div><div class="section"><a name="d0e12058"></a><div class="titlepage"><div><h3 class="title"><a name="d0e12058"></a>Entity Beans</h3></div></div><div class="section"><a name="d0e12061"></a><div class="titlepage"></div><p>To make an Entity Bean (EB) active in a cluster, you need to modify its deployment settings in jboss.xml:</p><p><pre class="programlisting">
<jboss>
<enterprise-beans>
<entity>
<ejb-name>nextgen.EnterpriseEntity</ejb-name>
<jndi-name>nextget.EnterpriseEntity</jndi-name>
<clustered>True</clustered>
</entity>
</enterprise-beans>
</jboss>
</pre></p><p>Thus, like for SLSB and SFSB, you simply need to add the <clustered> tag to your existing jboss.xml configuration file. By default, bean state is replicated in-memory in sub-groups of two nodes.</p><p>As Entity Beans clustering in JBoss is based on pessimistic locking at the database level, your database must support SQL instruction like "SELECT ... FOR UPDATE". Check in your database documentation if it supports such a feature.</p><p>Note: Entity Beans clustering has currently only been tested with Oracle.</p></div></div><div class="section"><a name="d0e12073"></a><div class="titlepage"><div><h3 class="title"><a name="d0e12073"></a>JNDI and HA-JNDI</h3></div></div><div class="section"><a name="d0e12076"></a><div class="titlepage"></div><p>By default, client code use the standard JBoss JNDI provider: JNP.</p><p>Nevertheless, a Highly Available (HA) JNDI server can also be used. To use it, you must have a list of cluster nodes in the provider URL list separated by commas (HA-JNDI default port is 1100): <pre class="programlisting">java.naming.provider.url=server1:1100,server2:1100,server3:1100</pre></p><p>Note that automatic discovery of HA-JNDI host is not yet available but is a planned feature.</p></div></div></div><table border="0" cellpadding="0" cellspacing="0" height="65"><tr height="65"><td rowspan="2"><img src="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="432" height="79"></td><td rowspan="2" background="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="100%" align="right" valign="top"><a href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html"><img src="doc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/doc.gif" border="0"></a><a href="ch13.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch13s135.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s135.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch14.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch14.html"><img src="next.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/next.gif" border="0"></a></td></tr><tr></tr></table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -