Created
August 10, 2014 09:27
-
-
Save djpentz/e252d91109500d4ae42f to your computer and use it in GitHub Desktop.
Configuring Tomcat for memcached persisted sessions on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Get the memcached session persistence JAR files. | |
wget http://repo1.maven.org/maven2/de/javakaffee/msm/memcached-session-manager/1.8.2/memcached-session-manager-1.8.2.jar | |
wget http://repo1.maven.org/maven2/de/javakaffee/msm/memcached-session-manager-tc7/1.8.2/memcached-session-manager-tc7-1.8.2.jar | |
wget http://repo1.maven.org/maven2/net/spy/spymemcached/2.11.1/spymemcached-2.11.1.jar | |
2. Copy those files into the Tomcat lib folder. | |
sudo cp memcached-session-manager-* /usr/share/tomcat7/lib | |
sudo cp spymemcached-* /usr/share/tomcat7/lib | |
3. Configure Tomcat's context.xml file. | |
/etc/tomcat7/context.xml: | |
<!-- The contents of this file will be loaded for each web application --> | |
<Context> | |
<!-- Default set of monitored resources --> | |
<WatchedResource>WEB-INF/web.xml</WatchedResource> | |
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager" | |
memcachedNodes="tomcat-sessions.ark24w.cfg.euw1.cache.amazonaws.com:11211" | |
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$" /> | |
<!-- Uncomment this to disable session persistence across Tomcat restarts --> | |
<!-- | |
<Manager pathname="" /> | |
--> | |
<!-- Uncomment this to enable Comet connection tacking (provides events | |
on session expiration as well as webapp lifecycle) --> | |
<!-- | |
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> | |
--> | |
</Context> | |
4. Restart Tomcat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment