http://www.terracotta.org/dl/oss-download-catalog
terracotta-3.3.0-installer.jar
java –jar terracotta-3.3.0-installer.jar
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
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
https://glassfish.java.net/downloads/3.0.1-final.html
glassfish-3.0.1-web-windows-ml.exe
Next...
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)
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.
Copy the war to the ../domains/robin/autodeploy , then will generate the app under the folder:
domains/robin/applications
Repeat the setp 2 to 5
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'
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.csdn.net/source/3224633
ehcache.xml
<? xml version = "1.0" encoding = "UTF-8" ?> < ehcache name = "ColorCache" > < defaultCache maxElementsInMemory = "10000" eternal = "false" timeToIdleSeconds = "120" timeToLiveSeconds = "120" overflowToDisk = "true" diskSpoolBufferSizeMB = "30" maxElementsOnDisk = "10000000" diskPersistent = "false" diskExpiryThreadIntervalSeconds = "120" memoryStoreEvictionPolicy = "LRU" /> < cache name = "colors" maxElementsInMemory = "100" maxElementsOnDisk = "0" eternal = "false" timeToIdleSeconds = "120" timeToLiveSeconds = "0" memoryStoreEvictionPolicy = "LFU" > < terracotta /> </ cache > <terracottaConfig url=" terracotta server ip :9510,server ip 2 : 9510"/> </ ehcache >
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
<!-- Sample Terracotta clustered cache named sampleTerracottaCache. This cache uses Terracotta to cluster the contents of the cache. --> <cache name="sampleTerracottaCache" maxElementsInMemory="1000" eternal="false" timeToIdleSeconds="3600" timeToLiveSeconds="1800" overflowToDisk="false"> <terracotta/> </cache> <!-- Sample xa enabled cache name xaCache --> <cache name="xaCache" maxElementsInMemory="500" eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="false" diskPersistent="false" diskExpiryThreadIntervalSeconds="1" transactionalMode="xa"> <terracotta clustered="true"/> </cache>
reference:
http://ehcache.org/documentation/
http://www.terracotta.org/start/distributed-cache-tutorial
http://www.terracotta.org/dl/ehcache-oss-download-catalog