memcached-session-manager session共享

sinaID18542發表於2014-02-28
大家好:
需求:不同tomcat之間實現session共享。(tomcatA和tomcatB取到同一sessionID)
實現:CentOs5.8 memcached-session-manager 1.8.1 tomcat-6.0.37
步驟:按照http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration
Example for multiple contexts sharing the same session id
If you are running multiple webapps/contexts sharing the same session id (e.g. by having set sessionCookiePath="/" - or emptySessionPath="true" in tomcat 6) you must tell memcached session manager to add a prefix to the session id when storing a session in memcached. For this you can use the storageKeyPrefix attribute as shown by this example (see also the more detailed attribute description below):

<Context sessionCookiePath="/">
...
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:host1.yourdomain.com:11211,n2:host2.yourdomain.com:11211"
failoverNodes="n1"
storageKeyPrefix="context"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
/>
</Context>

結果訪問不同的tomcat sessionID仍然不一樣,求解。

相關文章