Sunday, April 24, 2011

Setting up Coherence in Tomcat Clustered Environment

Update catalina.sh




XXX_OPTS="-Dtangosol.coherence.distributed.localstorage=false -Dtangosol.coherence.cacheconfig=$PROP_PATH/coherence_cache.xml -Dtangosol.coherence.override=$PROP_PATH/coherence_cache_override.xml"

export CATALINA_OPTS="-server -d64 -Xloggc:xxxx/gc.log -XX:+PrintGCDetails -Xms2048m -Xmx2048m -Dfile.encoding=UTF-8 -DKMSERVICES_HOME=$PROP_PATH $XXX_OPTS"
echo "Catalina OPTS "  $CATALINA_OPTS

below is the coherence_cache_override.xml



below is the coherence_cache.xml



Saturday, April 16, 2011

How to install/Test Coherence*WEB for Weblogic

Coherence Based Session Management

Assumptions: you have downloaded latest web logic server 10.3.3 and Coherence Web 3.6
                       from Oracle

Instructions

First we will create weblogic domains : something like DOMAIN_A and DOMAIN_B.
To configure those domains with coherence based session management, then the
changing of session variable value in one domain will propagate to another domain.

Main Steps

Application Server (WebLogic)

1) Create DOMAIN_A and DOMAIN_B
2) Copy coherence.jar to DOMAIN_A\lib and DOMAIN_B\lib
3) Start both the Domains
4) Deploy coherence-web-spi.war as a shared library

Coherence

1) duplicate cache-server.cmd at the same folder in the coherence and rename
    it to web-cache-server.cmd
2) modify web-cache-server.cmd as shown below
3) set java_opts="-Xms%memory% -Xmx%memory%"

"%java_exec%" -server -showversion "%java_opts%" -cp
c:\coherence\lib\coherence.jar;c:\coherence\lib\coherence-web-spi.war -
Dtangosol.coherence.management.remote=true -Dtangosol.coherence.cacheconfig=WEB-
INF/classes/session-cache-config.xml -Dtangosol.coherence.session.localstorage=true
com.tangosol.net.DefaultCacheServer %1

4) startup web-cache-server.cmd
5) Modify weblogic.xml to add a reference to coherence-web-spi as shown below
     in you application


 wls:library-ref
      wls:library-name   coherence-web-spi  wls:library-name
      wls:specification-version   1.0.0.0  wls:specification-version
      wls:exact true  wls:exact
wls:library-ref


deploy the webapp to DOMAIN_A and DOMAIN_B

Now test Session variable value at DOMAIN_A and check wether it is changed at DOMAIN_B, As show in the below figure

Coherence In Action

Tuesday, April 12, 2011

Setting Up Tomcat Multiple Instances

Setting up tomcat multiple instances

1) First Original Instance, download apache-tomcat-5.5.33 ( any version) this will be the original
Instance and change nothing here.

2) For the instance 2 ... to N do the following as mentioned below

a) Create a new Folder (TomcatInstance1….N) as many as you instances as you want
b) Copy following folders over to TomcatInstance1… to N
conf
logs
temp
webapps
work
c) Write a script to startup/shutdown the second instance(name it as startup.sh
and shutdown.sh) and place under TomcatInstance1..N folders
d) Add following to the newly created startup.sh


CATALINA_HOME=~/Documents/apache-tomcat-5.5.33
CATALINA_BASE=~/Documents/TomcatInstance1
export CATALINA_HOME CATALINA_BASE


$CATALINA_HOME/bin/catalina.sh start

e) Add the following to the newly created shutdown.sh


CATALINA_HOME=~/Documents/apache-tomcat-5.5.33
CATALINA_BASE=~/Documents/TomcatInstance1
export CATALINA_HOME CATALINA_BASE


$CATALINA_HOME/bin/catalina.sh stop

f) Modify the server.xml file in TomcatInstance1/conf/server.xml and change the port
number to 8180

AND change port number to 8109 for the Connector Port of "AJP/1.3"

That's it now start the server with following command " sh startup.sh" and login to
http://localhost:8180 and you should see the tomcat page, do the same for as many instances as you want

How to install/Test Coherence*WEB for Tomcat

Steps to Create

First Install Coherence*Web in your local directory

1) Complete the application inspection step by running the following command.
Specify the full path to your application and the name of your server
(replacing the and with them in the command line below):

java -jar webInstaller.jar
-inspect -server:

e;g java -jar WebInstaller.jar c:\MyCoherenceWeb -inspect -server:Tomcat/5.5


The system will create the coherence-web.xml

2) Complete the Coherence Web application installation step by running the following command,
replacing with the full path to your application:

java -jar webInstaller.jar
-install
e;g java -jar webInstaller.jar c:\MyCoherenceWeb -install


The installer requires a valid coherence-web.xml configuration file to reside
in the same directory as the application

checking if this process is correctly installed or not by verifying the application.war file.

1) Make sure you have a coherence-web.xml in you META-INF file.
2) Installer will Add the following directive to each JSP Page that you have in application

3) Installer will modify and add Coherence Web configuration context parameters in web.xml
descriptor and also add's a listener classes at the end of the web.xml file
4) Make sure you classes folder will have "session-cache-config.xml" file generated.
5) Make sure you lib folder contain coherence.jar and coherence-web.jar

Create ElasticSearch cluster on single machine

I wanted to figure out how to create a multi-node ElasticSearch cluster on single machine. So i followed these instructions First i did...