Skip to content

hazelcastInternsSummer14/sessionReplicationApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ABOUT

This project is prepared to serve as a sample application for Hazelcast, the leading open source in-memory data grid . Here, Hazelcast's use case is HTTP Session Replication.

Prerequisites

You should have installed Apache Tomcat7 and Apache Maven 3.2.1 on your system. Download links are given below. Choose appropriate one for you.

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/

Tomcat Configuration

  1. Unzip hazelcast-EE-<version>.zip file into the folder $HAZELCAST_ENTERPRISE_ROOT. Under the $HAZELCAST_ENTERPRISE_ROOT$/lib folder, Put hazelcast-<VERSION>-ee.jar and hazelcast-sessions-tomcat7-<VERSION>.jar to your $CATALINA_HOME$/lib folder.

  2. Put hazelcast.xml file to $CATALINA_HOME$/lib.

  3. Open $HAZELCAST_ENTERPRISE_ROOT/conf/context.xml file and add this line

<Manager className="com.hazelcast.session.HazelcastSessionManager" /> between <Context> and </Context> tags.

  1. Open $CATALINA_HOME$/conf/context.xml/conf/server.xml file and add a listener

<Listener className="com.hazelcast.session.P2PLifecycleListener" />


How to Run Sample Application

  1. Go to $CATALINA_HOME$/bin and run startup.sh shell file from terminal.

  2. Clone the repository via git clone https://github.com/hazelcastInternsSummer14/sessionReplicationApp.git

  3. Then go to sessionReplicationApp folder.

  4. Run maven via mvn package

  5. Maven creates example.war file under sessionReplicationApp/target folder.

  6. Copy example.war file to $CATALINA_HOME$/webapps folder

  7. Open a browser and enter localhost:8080/example/hazelcast

NOTES

-You can use Apache Tomcat 6 instead of Tomcat 7.
-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.

Releases

No releases published

Packages

No packages published

Languages