Preparations:
1. Redis server (installed, redis-3.2.5)
2. Tomcat7 (deployed)
3. JDK1.7 (installed)
Precautions:
1. You need to prepare 3 jar packages: tomcat-redis-session-manage-tomcat7.jar jedis-2.7.2.jar commons-pool2-2.2.jar
2. The shared objects stored in the session need to be serialized (implements java.io.Serializable)
Steps:
1. Place the three jar packages in the lib directory of Tomcat
2. Modify Tomcat's context.xml (under the conf directory) and add related configurations:
Among them, password is the authentication password for connecting to the Reids server, if not, you can not configure this item; database is the database selected for connection.
<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
host="192.168.1.123"
port="6379"
database="0"
maxInactiveInterval="60" password="123456" />