paulwong

实战JBossMQ JMS集群

一、环境
数据库服务器:Oracle 9i2
操作系统:Windows XP SP2
JBoss版本:4.2.2
JDK:Sun 1.5.0.13
网络配置:同一机器的一个网卡上绑定两个ip地址192.168.1.18和192.168.1.147


二、配置
1.配置消息和事务日志持久保存的数据源,从JBoss安装位置的docs\examples\jca目录下拷贝到server\all\deploy目录下,并修改其中的连接配置,这里使用OracleDS作为持久保存的数据源。注意:别忘了把Oracle的jdbc驱动程序拷贝到server\all\lib目录下。

2.修改DestinationManager配置,删除server\all\deploy-hasingleton\jms目录下的hsqldb-jdbc2-service.xml文件,拷贝docs\examples\jms目录下的oracle-jdbc2-service.xml到server\all\deploy-hasingleton目录下,使用OracleDS作为DestinationManager的数据源。

3. 修改StateManager配置,将其中的数据源配置由
jboss.jca:service=DataSourceBinding,name=DefaultDS 
jboss.jca:service=DataSourceBinding,name=OracleDS

4. 配置测试的Topic,在server\all\deploy-hasingleton\jms目录下新建一个名为jbossweek-jms-service.xml文件,
<mbean code="org.jboss.mq.server.jmx.Topic" name="jboss.mq.destination:service=Topic,name=jbossweekTopic">
        
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>

5. 创建node1的服务器配置,将server\all目录复制一份改名为node1

6. 配置完成。


三、验证
1. 分别以run –c all –b192.168.1.17和run –c node1–b192.168.1.148先后启动all和node1配置。此时192.168.1.17为主节点,浏览http://192.168.1.17:8080/jmx-console/。打开JNDIView可以看到jbossweekTopic的JNDI名称。此时192.168.1.17为主节点,浏览http://192.168.1.148:8080/jmx-console/。打开JNDIView就会发现没有jbossweekTopic的JNDI名称。

2. 关闭192.168.1.17上的all服务器,此时在192.168.1.148上的node服务器的控制台上会出现如下信息:
13:11:13,921 INFO [TreeCache] viewAccepted(): [192.168.1.17:2292|2] [192.168.1.148:2327]
13:11:14,015 INFO [TreeCache] viewAccepted(): [192.168.1.17:2288|2] [192.168.1.148:2321]
13:11:14,218 INFO [DefaultPartition] New cluster view for partition DefaultPartition (id: 2, delta: -1) : [192.168.1.148:1099]
13:11:14,218 INFO [DefaultPartition] I am (192.168.1.148:1099) received members hipChanged event: 13:11:14,218 INFO [DefaultPartition] Dead members: 1 ([192.168.1.17:1099])
13:11:14,218 INFO [DefaultPartition] New Members : 0 ([])
13:11:14,218 INFO [DefaultPartition] All Members : 1 ([192.168.1.148:1099])
13:11:14,453 INFO [TreeCache] viewAccepted(): [192.168.1.17:2279|2] [192.168.1.148:2306]
13:11:16,218 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy-hasingleton/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
13:11:17,406 INFO [jbossweekTopic] Bound to JNDI name: topic/jbossweekTopic
13:11:17,453 INFO [A] Bound to JNDI name: queue/A
13:11:17,453 INFO [B] Bound to JNDI name: queue/B
13:11:17,468 INFO [C] Bound to JNDI name: queue/C
13:11:17,468 INFO [D] Bound to JNDI name: queue/D
13:11:17,468 INFO [ex] Bound to JNDI name: queue/ex
13:11:17,484 INFO [testTopic] Bound to JNDI name: topic/testTopic
13:11:17,500 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
13:11:17,500 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
13:11:17,500 INFO [testQueue] Bound to JNDI name: queue/testQueue
13:11:17,562 INFO [UILServerILService] JBossMQ UIL service available at : /192.168.1.148:8093 13:11:17,609 INFO [DLQ] Bound to JNDI name: queue/DLQ

3. JMS集群的主节点自动切换到192.168.1.148上的node1节点,浏览http://192.168.1.148:8080/jmx-console/。打开JNDIView就会找到jbossweekTopic的JNDI名称。


http://linliangyi2007.iteye.com/blog/316997
http://docs.redhat.com/docs/zh-CN/JBoss_Enterprise_Application_Platform/5/html/JBoss_Messaging_User_Guide/index.html

posted on 2012-01-08 23:58 paulwong 阅读(796) 评论(0)  编辑  收藏 所属分类: JBOSS


只有注册用户登录后才能发表评论。


网站导航: