`
C_LIFE
  • 浏览: 35152 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

WebLogic Server高级管理之三:集群下的HTTP Session管理

 
阅读更多
声明:该博文转自http://maping930883.blogspot.com,热爱java,热爱生活
运行环境:WebLogic Server 10.3.5 + Oracle Database 10g Express Edition 10.2.0.1。
WebLogic Server集群可以用来在多个Server之间复制HTTP Session,复制方式有内存复制和数据库持久化两种。
(1)内存复制方式



(2)数据库持久化方式



1. 内存复制方式
(1)在dizzy1-->上设置主备复制组:dizzyRepGroup1(主)、dizzyRepGroup2(备)。



(2)在dizzy1-->上设置主备复制组:dizzyRepGroup2(主)、dizzyRepGroup1(备)。



(3)修改应用中的weblogic.xml内容,增加如下内容:
<session-descriptor>
<persistent-store-type>replicated_if_clustered</persistent-store-type>
</session-descriptor>
(4)发布应用shoppingcart.war到Cluster上。
(5)访问http://localhost:7009/shoppingcart/



选中一些商品,放入到Session中



Shutdown接收请求的Server,比如dizzy2,然后刷新页面,发现Session信息依然存在,说明内存复制Session方式起作用了。

2. 数据库持久化方式
(1)配置和内存复制方式相同。
(2)配置和内存复制方式相同。
(3)创建数据库表:wl_servlet_sessions。
选择一个Schema,比如HR,创建表wl_servlet_sessions。
create table wl_servlet_sessions
( wl_id VARCHAR2(100) NOT NULL,
wl_context_path VARCHAR2(100) NOT NULL,
wl_is_new CHAR(1),
wl_create_time NUMBER(20),
wl_is_valid CHAR(1),
wl_session_values LONG RAW,
wl_access_time NUMBER(20),
wl_max_inactive_interval INTEGER,
PRIMARY KEY (wl_id, wl_context_path) );

(4)创建Data Source:SessionDS
注意要把SessionDS target到dizzyworldCluster上。

(5)修改应用中的weblogic.xml内容,增加如下内容:
<session-descriptor>
<persistent-store-type>jdbc</persistent-store-type>
<persistent-store-pool>SessionDS</persistent-store-pool>
<persistent-store-table>WL_SERVLET_SESSIONS</persistent-store-table>
</session-descriptor>

(6)重新发布应用shoppingcart.war到Cluster上。
(7)访问http://localhost:7009/shoppingcart/
选中一些商品,放入到Session中后,Shutdown所有Server,查看数据库表,发现有记录。
说明HTTP Session信息已经持久化到数据库表中了。



重新启动Server,访问应用,发现Session信息都还存在,说明数据库持久化Session方式起作用了。
  • 大小: 53.3 KB
  • 大小: 71.8 KB
  • 大小: 58.8 KB
  • 大小: 59 KB
  • 大小: 53.7 KB
  • 大小: 12.8 KB
  • 大小: 37.2 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics