1.Terracotta
1.1 DownLoad the Terracotta
http://www.terracotta.org/dl/oss-download-catalog
terracotta-3.3.0-installer.jar
1.2 Install the Terracotta
java –jar terracotta-3.3.0-installer.jar
1.3 Start the Terracotta server
run the bat file:
terracotta-3.3.0/bin start-tc-server.bat
but if your system is linux or unix,you should run the terracotta-3.3.0/bin start-tc-server.sh
1.4 Start the Terracotta Developer Console and view the cluster
Run the bat file :
terracotta-3.3.0/bin dev-console.bat ,
but if your system is linux or unix,you should run the terracotta-3.3.0/bin dev-console.sh
If you have the desktop shorcut or start menu,also can start the console.
Figure 1
Figure 2
2 Glassfish V3
2.1 Download the Glassfish v3
https://glassfish.java.net/downloads/3.0.1-final.html
glassfish-3.0.1-web-windows-ml.exe
2.2 Install the Glassfish v3
Next...
2.3 Start the Glassfish
You can use the default domain(domain1),but you can create your own domain,just like this:
glassfishv3/bin>asadmin create-domain --profile cluster --adminport 4848 robin
by the way ,during the installing ,need to enter the user name and password,
eg:username admin
password adminadmin
then you can start the server:
glassfishv3/bin>asadmin start-domain robin
(note: need to enter the password:adminadmin)
2.4 About version
If you using the cluster server, we should create the node, but for version 3,it doesn’t support (Maybe support it later.) The version 2 can work.
2.5 Deploy the application
Copy the war to the ../domains/robin/autodeploy , then will generate the app under the folder:
domains/robin/applications
2.6 Install another Glassfish v3
Repeat the setp 2 to 5
2.7 Test
http://server1ip:8080/colorcache/index.jsp
http://server2ip:8080/colorcache/index.jsp
For the server1,
Input 'black' and Review Color,
then change to server 2,refresh the page,you'll see the cache color 'black'
3. Demo
This demo I got from the sample,and modified the coding and configuration.
commons-logging.jar ,ehcache-core-2.2.0.jar,ehcache-terracotta-2.2.0.jar,slf4j-api-1.5.11.jar,slf4j-jdk14-1.5.11.jar,terracotta-toolkit-1.0-runtime-1.0.0.jar,servlet-api-2.5-6.1.8.jar
I remove the jar from the attachment,you can added them by yourself.
You can downlode the demo(src file) from here: http://download.youkuaiyun.com/source/3224633
ehcache.xml
Maybe you should copy this file to overwrite the default config of the terracotta if the dev console can’t show Ehcache node.
/terracotta-3.3.0/ehcache ehcache.xml
By the way, there have more configuration in the demo file:
under the folder terracotta-3.3.0/ehcache
ehcache.xml
reference:
http://ehcache.org/documentation/
http://www.terracotta.org/start/distributed-cache-tutorial
http://www.terracotta.org/dl/ehcache-oss-download-catalog