Pivotal Knowledge Base

Follow

How to Create HTTP Session Management with tcServer3.0

Applies To

Gemfire HTTP Session Management Module 7.0.2.3+

Purpose

This document presents an example of how to create a Client/Server topology GemFire HTTP Session Management Module for tcServer 3.0.

Solution

Gemfire HTTP Session Management Module 7.0.2.3 (included in GemFire 7.0.2.8) is the first to support tcServer 3.0, so you must use this, or a later distribution, if you are using tcServer 3.0.x.

Steps:

  1. Download the pivotal-tc-server-standard-3.0.2.SR2 from Pivotal Network and unzip the pivotal-tc-server-standard-3.0.2.SR2.zip to a folder such as /home/gpadmin/samples.

  2. Change directory to /home/gpadmin/samples/pivotal-tc-server-standard-3.0.2.SR2 and run the following command to crease tcServer instance named [GemfireSessionSample1].

    gpadmin#./tcruntime-instance.sh create GemfireSessionSample1 --template gemfire-cs
  3. Change the default HTTP port, 8080, of the GemFire session instance to another port, such as 8090, to avoid potential conflicts in this environment (for instance, the GemFire JMX manager's default port is also 8080).

    For example:

    /home/gpadmin/samples/pivotal-tc-server-standard-3.0.2.SR2/GemfireSessionSample1/conf/catalina.properties

    bio.http.port=8090

    Also, review and change the following properties as necessary:

    gemfire-cs-tomcat-7.enable.commit.valve=true
    gemfire-cs-tomcat-7.enable.debug.listener=false
    gemfire-cs-tomcat-7.enable.gateway.replication=false
    gemfire-cs-tomcat-7.enable.local.cache=true
    gemfire-cs-tomcat-7.prefer.deserialized.form=true
    gemfire-cs-tomcat-7.region.attributes.id=PARTITION_REDUNDANT
    gemfire-cs-tomcat-7.region.name=gemfire_modules_sessions
    base.jmx.port=6969
    bio.http.port=8090
    bio.https.port=8443
    gemfire-cs.cache.configuration.file=cache-client.xml
    gemfire-cs.critical.heap.percentage=0.0
    gemfire-cs.eviction.heap.percentage=80.0
    gemfire-cs.log.file=gemfire_modules.log
    gemfire-cs.statistic.archive.file=gemfire_modules.gfs
    gemfire-cs.statistic.sampling.enabled=false
  4. Change the host and port to a proper value in cache_client.xml.

    For example:

    /home/gpadmin/samples/pivotal-tc-server-standard-3.0.2.SR2/GemfireSessionSample1/conf/cache-client.xml

    <server host="localhost" port="40404"/>
    -->
    <locator host="pivhdsne.localdomain" port>="7900"/>
  5. Add a gemfire_modules_sessions region declaration to your cache_client.xml.

    For example:
    /home/gpadmin/samples/pivotal-tc-server-standard-3.0.2.SR2/GemfireSessionSample1/conf/cache-client.xml

    <region-attributes id="clientAttributes" pool-name="sessions" refid="CACHING_PROXY"/>
    <region name="gemfire_modules_sessions">
    <region-attributes refid="clientAttributes"/>
    </region>
  6. Uncomment out the gemfire_modules_sessions region definition in cache-server.xml and start a gemfire cluster(gemfireServer1.zip) using this cache-server.xml (i.e. copy it to your gemfire cluster's xml folder).

    /home/gpadmin/samples/pivotal-tc-server-standard-3.0.2.SR2/GemfireSessionSample1/conf/cache-server.xml

    <region name="gemfire_modules_sessions">
    <region-attributes enable-gateway="false" data-policy="partition" statistics-enabled="true">
    <partition-attributes redundant-copies="1" total-num-buckets="113"/>
    </region-attributes>
    </region>

    Note: to simplify the sample, I removed the eviction setting in the above region definition.

  7. deploy a sample war cartsample.war into the GemfireSessionSample1 instance.

    For example:

    /home/gpadmin/samples/pivotal-tc-server-standard-3.0.2.SR2/GemfireSessionSample1/webapps/cartsample.war

     

  8. Start GemfireSessionSample1 instance using tcruntime-ctl.sh.

    For example:

    gpadmin#/home/gpadmin/samples/pivotal-tc-server-standard-3.0.2.SR2/tcruntime-ctl.sh GemfireSessionSample1 start
  9. Access the sample web application using the following like URL (for example):

    http://pivhdsne.localdomain:8090/cartsample/Cart.jsp

  10. Review the logs in GemfireSessionSample1/logs if you have any issues. If needed, you can also change the log level in GemfireSessionSample1/conf/logging.properties. For example:

    catalina.2015-01-22.log
    catalina.out
    gemfire_modules.log

References

  1. User Guide:  http://gemfire.docs.pivotal.io/7.0.2/userguide/index.html#tools_modules/http_session_mgmt/session_mgmt_tcserver.html

Comments

Powered by Zendesk