[jboss-user] [Beginners Corner] - JBoss and clustering basics

ianfallon do-not-reply at jboss.com
Wed Mar 28 13:07:46 EDT 2007


Hi all,

At the risk of posting some really stupid questions ...

I need to create a redundant system with no single point of failure with 2 machines, each running an instance of JBoss and MySQL. These should be symmetric such that if one goes down the other handles requests and the DBs stay in sync. They should also share load if both are up.

I am trying to use EJB3+JBoss(clustered)+MySQL to achieve this. (Good or bad idea ?!)

I have tried to setup a simple system to gain an understanding of the myriad of bits of JBoss/Hibernate/JBCache/MySQL technology involved and all the XML fragments etc etc that need to all be in line.

I have installed the 2 machines (Windows for now) with identical JBoss 4.0.5GA app servers (ejb3-cluster deployment) and MySQL 4.1.2.
I have trawled through so so many bits of docs and seemingly have the XML and code annotations in place for the system to cache some simple entities.

Machine A has a populated DB and machine B has an empty DB.

The cluster seems to come up correctly and I make a client call on machine A. The cache on A is populated (according the JMX console) and the correct results returned. The cache on B also updates (as seen in the JMX console) but client requests on machine B always return what is in the DB (i.e. nothing), not what is in the cache! So it looks like Hibernate is not using the cache.

Here is my persistence.xml file:


  | <persistence>
  | 	<persistence-unit name="ejb3trail">
  | 
  | 		<provider>org.hibernate.ejb.HibernatePersistence</provider>
  | 		<jta-data-source>java:/TestDS</jta-data-source>               
  | 		<properties>
  | 			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>			
  | 			<property name="hibernate.cache.use_query_cache" value="true"/>
  | 			
  | 			<property name="hibernate.show_sql" value="true"/>
  | 			<property name="hibernate.hbm2ddl.auto" value="update"/>
  | 			<property name="hibernate.connection.datasource" value="java:/TestDS"/>
  | 
  | 			<property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
  | 			<property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/>
  | 		</properties>
  | 
  | 	</persistence-unit>
  | </persistence>
  | 

Any help appreciated I am at the end of my patience! also, are there any top level overviews of this stuff with answers to "obvious" questions like: Do you have to replicate the DB separately from the cache ? Or should the cache be writing changes to entities back to the DB ?

Also any pointers or references to help decide what is the best set of technologies (some proven examples would be great) to use for a clustered Java/DB solution would be really helpful before we decide the EJB3/JBoss route.

Best regards and thanks in advance,

Ian

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032455#4032455

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032455



More information about the jboss-user mailing list