生活随笔
收集整理的這篇文章主要介紹了
windows7+tomcat7+nginx1.11.3 +memcached
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
測試的環(huán)境是windows7+tomcat7+nginx1.11.3 +memcached
安裝方法網(wǎng)上很多就不多說了。?
1.session共享需要這幾個jar 包?
?
下載地址?
http://download.csdn.net/detail/scau_rich/7791157?
2.解壓到tomcat lib目錄下面 兩個tomcat都需要。?
3.新建JSP頁面放入tomca webapps/root目錄下面(兩個tomcat都要放)
<%@page language="java"%>
<html>
<body> <h1><font color="red">Session serviced by tomcat</font></h1> <table aligh="center" border="1"> <tr> <td>Session ID</td> <td><%=session.getId() %></td> <% session.setAttribute("abc","abc");%> </tr> <tr> <td>Created on</td> <td><%= session.getCreationTime() %></td> </tr> </table> </body> <html> - 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
4.在tomcat的conf文件夾里面配置content.xml 兩個tomcat 都需要配置?
`
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource><!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:localhost:11211"
requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"
sessionBackupAsync="false"
sessionBackupTimeout="100"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
copyCollectionsForSerialization="false" /> <!-- Uncomment this to enable Comet connection tacking (provides eventson session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
`?
5.運行tomcat .nginx memcahced?
6.打開瀏覽器。按F5刷新?
?
?
看到這個說明session共享成功了
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎
總結(jié)
以上是生活随笔為你收集整理的windows7+tomcat7+nginx1.11.3 +memcached的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。