Apsaradb for redis is used to save the session on tomat7.

Source: Internet
Author: User
Tags download redis redis server

It is advantageous to use the redis server to store sessions. First, it is a nosql data, and second, it is easy to expand and use.

The following installation method clearly guides you to use redis cache as a session storage system. The procedure is as follows:

1. Download redis and use the following command to compile and install it:
wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make
2. Run the following command to start redis:
cd RedisDirectory/src./redis-server --port 6379
3. download the latest Tomcat 7. download the latest Jedis (A redis Java client), Tomcat redis Session Manager and Apache commons pool 5. copy all the jar packages above to the lib directory under the Tomcat 7 installation directory 6. in the conf/context. add the following content to the XML file (or in the server. add in the context block of XML ):
<Valve classname = "com. radiadesign. Catalina. session. redissessionhandlervalve"/> <manager classname = "com. radiadesign. Catalina. session. redissessionmanager" host = "localhost" <! -- Optional. The default value is "localhost" --> Port = "6379" <! -- Optional. The default value is "6379" --> database = "0" <! -- Optional. The default value is "0" --> maxinactiveinterval = "60" <! -- Optional; default value: 60 (unit: seconds) -->/>
7. Restart Tomcat 7. Now you can see that the session content is created in redis.

Now, the session of Tomcat 7 is saved to redis, and it also maintains different aspects of the session.

Components:
Redis:http://redis.io/JRedis: https://github.com/xetorthio/jedisTomcat Redis Session Manager :https://github.com/jcoleman/tomcat-redis-session-manager/downloadsApache Commons Pool :http://commons.apache.org/proper/commons-pool/download_pool.cgi

Apsaradb for redis is used to save the session on tomat7.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.