分类: LINUX
2011-12-12 15:19:38
软件及环境:
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在不同的机器上保持不变,那就集成功了!如下图: