An open API service indexing awesome lists of open source software.

https://github.com/appng/appng-tomcat-session

Support for stateless appNG nodes by storing the user session in an external session store.
https://github.com/appng/appng-tomcat-session

clustering jedis mongodb redis tomcat

Last synced: 7 months ago
JSON representation

Support for stateless appNG nodes by storing the user session in an external session store.

Awesome Lists containing this project

README

          

image::https://raw.githubusercontent.com/appNG/appng/master/appng-logo.png[]

:version: 0.3.0-SNAPSHOT
:mongo-version: 3.12.8
:jedis-version: 4.2.3
:pool2-version: 2.11.1
:hazelcast-version: 5.1.2

== appNG Tomcat Session
This library contains implementations of http://tomcat.apache.org/[Apache Tomcat^]s
https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/Manager.html[org.apache.catalina.Manager^]
using https://redis.io/[Redis^],
https://hazelcast.org[Hazelcast^]
and https://www.mongodb.com[MongoDB^].

== Prerequisites
By default, Tomcats uses it's own logging component named JULI, writing logfiles to `CATALINA_HOME/logs`.

However, if you want to see some logging in the `appNG.log` of your appNG installation, *move* the following files from `APPNG_HOME/WEB-INF/lib` into the `CATALINA_HOME/lib` directory:

* log4j-1.2.17.jar
* slf4j-api-1.7.25.jar
* slf4j-log4j12-1.7.25.jar

Next, set the category for `org.appng.tomcat.session` in `APPNG_HOME/WEB-INF/conf/log4j.properties` to the required level:
[source,plain]
----
log4j.category.org.appng.tomcat.session = trace
----

== Using Redis
This implementation uses https://redis.io/[Redis^] to store sessions.
It is based on the great work of James Coleman's https://github.com/jcoleman/tomcat-redis-session-manager[tomcat-redis-session-manager^].

A few changes were made to support Tomcat 8 and the latest version of Redis.

=== Configuration
Add the following into your Tomcat `context.xml` (or the context block of the `server.xml` if applicable.)

[source,xml]
----

----

Copy the following files into the `TOMCAT_BASE/lib` directory:

* appng-tomcat-session-{version}.jar
* http://repo1.maven.org/maven2/redis/clients/jedis/{jedis-version}/jedis-{jedis-version}.jar[jedis-{jedis-version}.jar^]
* http://repo1.maven.org/maven2/org/apache/commons/commons-pool2/{pool2-version}/commons-pool2-{pool2-version}.jar[commons-pool2-{pool2-version}.jar^]

Reboot the server, and sessions should now be stored in Redis.

== Using MongoDB
This implementation uses https://www.mongodb.com[MongoDB^] to store sessions.

=== Configuration
Add the following into your Tomcat `context.xml` (or the context block of the `server.xml` if applicable.)

[source,xml]
----

----

Copy the following files into the `TOMCAT_BASE/lib` directory:

* appng-tomcat-session-{version}.jar
* http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/{mongo-version}/mongo-java-driver-{mongo-version}.jar[mongo-java-driver-{mongo-version}.jar^]

Reboot the server, and sessions should now be stored in MongoDB.

== Using Hazelcast
The implementation is based on https://hazelcast.org[Hazelcast^],
using an https://docs.hazelcast.org/docs/{hazelcast-version}/javadoc/com/hazelcast/map/IMap.html[IMap].

=== Configuration
Add the following into your Tomcat `context.xml` (or the context block of the `server.xml` if applicable.)

[source,xml]
----



----

Copy the following files into the `TOMCAT_BASE/lib` directory:

* appng-tomcat-session-{version}.jar
* http://repo1.maven.org/maven2/com/hazelcast/hazelcast/{hazelcast-version}/hazelcast-{hazelcast-version}.jar[hazelcast-{hazelcast-version}.jar]

Reboot the server, and sessions are now stored in Hazelcast.

== License
appNG is licensed under the https://www.apache.org/licenses/LICENSE-2.0[Apache License 2.0^].