Apache Tomcat7
- http://tomcat.apache.org/download-70.cgi
Apache Maven 3.2.1 or higher
- http://maven.apache.org/download.cgi
Hazelcast EE 3.3 or higher
- http://hazelcast.com/products/hazelcast-enterprise/
-
Unzip
hazelcast-EE-<version>.zip
file into the folder$HAZELCAST_ENTERPRISE_ROOT
. Under the$HAZELCAST_ENTERPRISE_ROOT$/lib
folder, Puthazelcast-<VERSION>-ee.jar
andhazelcast-sessions-tomcat7-<VERSION>.jar
to your$CATALINA_HOME$/lib
folder. -
Put
hazelcast.xml
file to$CATALINA_HOME$/lib
. -
Open
$HAZELCAST_ENTERPRISE_ROOT/conf/context.xml
file and add this line
<Manager className="com.hazelcast.session.HazelcastSessionManager" />
between <Context>
and </Context>
tags.
- Open
$CATALINA_HOME$/conf/context.xml/conf/server.xml
file and add a listener
<Listener className="com.hazelcast.session.P2PLifecycleListener" />
-
Go to
$CATALINA_HOME$/bin
and run startup.sh shell file from terminal. -
Clone the repository via
git clone https://github.com/hazelcastInternsSummer14/sessionReplicationApp.git
-
Then go to sessionReplicationApp folder.
-
Run maven via
mvn package
-
Maven creates
example.war
file under sessionReplicationApp/target folder. -
Copy example.war file to
$CATALINA_HOME$/webapps
folder -
Open a browser and enter
localhost:8080/example/hazelcast
-If you want to use client only mode, there must be another hazelcast instance that is working in your network.
Also you have to update manager tag in `$CATALINA_HOME$/conf/context.xml` file. An example is shown below:
<Context>
<Manager className="com.hazelcast.session.HazelcastSessionManager"
clientOnly="true"/>
</Context>
-You can find detailed explanations at: http://hazelcast.org/docs/latest/manual/html/sessionreplication.html
-You can use Hazelcast session replication feature if you have many servers that have load-balancer in front of them.
One server goes down, session will not lost.