啥也没写
分类: LINUX
2010-10-13 16:23:16
JBOSS集群安装
软件及环境:
jboss-5.1.0.GA
nginx-0.8.15
centos5.5
nginx:192.168.1.251
tomat1:192.168.1.251
tomat2:192.168.1.252
jboss安装目录为:/usr/local/jboss
nginx安装目录为:/usr/local/nginx
JDK、JBOSS、nginx安装略过!
Jboss1配置:
/usr/local/jboss/server/all/deploy/jbossweb.sar/server.xml
将
将
/usr/local/jboss/server/all/deploy/messaging/messaging-service.xml
将20行的
Jboss2配置:
/usr/local/jboss/server/all/deploy/jbossweb.sar/server.xml
将
将
/usr/local/jboss/server/all/deploy/messaging/messaging-service.xml
将20行的
如果想要session同步的话,要在站点的web.xml里面加入
测试文件index.jsp内容如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="java.net.InetAddress;"%>
<%
InetAddress ip = InetAddress.getLocalHost();
//out.println(ip.getHostAddress());
%>
This is responsed by <%=ip.getHostAddress() %>
Host Name : <%=ip.getHostName() %>
Time : <%=new Date() %>
<%
ip = null;
%>
Server Info:
<%
out.println(request.getLocalAddr() + " : " + request.getLocalPort()+"
");%>
<%
out.println("
Session ID " + session.getId()+"
");
// 如果有新的 Session 属性设置
String dataName = request.getParameter("dataName");
if (dataName != null && dataName.length() > 0) {
String dataValue = request.getParameter("dataValue");
session.setAttribute(dataName, dataValue);
}
out.print("
Session 列表");
Enumeration e = session.getAttributeNames();
while (e.hasMoreElements()) {
String name = (String)e.nextElement();
String value = session.getAttribute(name).toString();
out.println( name + " = " + value+"
");
System.out.println( name + " = " + value);
}
%>
名称:
值:
Jboss动好像没什么要求,,可以两个同时启动,等启动完之后再启动NGINX就OK了!
Jboss的启动命令为:
/usr/local/jboss/bin/run.sh -c all
等都启动完成,就可以防问
写一个session,刷新,如果session在不同的机器上保持不变,那就集成功了!如下图:
chinaunix网友2010-10-14 17:17:14
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com