Terracotta + EhCache + Hibernate 2nd level cache + Jboss 7.2 + distributed 2 JVM's

147 views
Skip to first unread message

lakshmanan bhaskar

unread,
Mar 10, 2017, 4:35:35 AM3/10/17
to terracotta-oss


I'm very new to Terracotta. Help needed in establishing a distributed caching using Terracotta. 

Currently I'm using Terracotta 3.7.0 server running on Windows machine. I would like to establish a distributed caching using EhCache 2.6.0 & Terracotta. 

I would be running 2 Application servers connected to a Single database.  Would like to use terracotta in establishing a distributed cache but facing difficulty is settings up one.

Below is my ehcache.xml

<?xml version="1.0" encoding="UTF-8"?>

xsi:noNamespaceSchemaLocation="http://www.ehcache.org/ehcache.xsd"
updateCheck="false" name="QualExecMgmtCacheManager">

<defaultCache
    maxElementsInMemory="0"
    eternal="false"
    timeToIdleSeconds="1200"
    timeToLiveSeconds="1200">
        <terracotta />
</defaultCache>
 
<terracottaConfig url="localhost:9510, audimex-dev-was:9510" />

<!-- Cache configuration for LastTelegramId -->
<cache name="LastTelegramId"
maxElementsInMemory="3000" maxElementsOnDisk="1000" eternal="false"
overflowToDisk="false" timeToIdleSeconds="120" timeToLiveSeconds="300"
statistics="true" >
<terracotta/>
</cache>
</ehcache>



Below is my tc-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. -->
<!-- This Terracotta configuration file is intended for use with Terracotta for Hibernate. -->
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-6.xsd"

 <servers>
   <!-- Sets where the Terracotta server can be found. Replace the value of
        host with the server's IP address. -->
   <server host="localhost" name="Server1">
     <data>%(user.home)/terracotta/server-data</data>
     <logs>%(user.home)/terracotta/server-logs</logs>
   </server>
   <!-- If using a standby Terracotta server, also referred to as an ACTIVE-
        PASSIVE configuration, add the second server here. -->
   <server host="audimex-dev-was" name="Server2">
     <data>%(user.home)/terracotta/server-data</data>
     <logs>%(user.home)/terracotta/server-logs</logs>
   </server>
   <ha>
      <mode>networked-active-passive</mode>
      <networked-active-passive>
         <election-time>5</election-time>
      </networked-active-passive>
   </ha>
 </servers>
 <!-- Shows where to put the generated client logs -->
 <clients>
   <logs>%(user.home)/terracotta/client-logs</logs>

 <!-- Names the Terracotta Integration Modules (TIM) needed for clustering specific technologies. -->
   <modules>
    <module name="tim-ehcache-2.x" />
<module name="tim-jboss-7.x"/>
<module name="tim-hibernate"/>
   </modules>
 </clients>
 <application>
 <dso>
 <web-applications>
   <web-application>indus</web-application>
 </web-applications>
 </dso>
</application>
</tc:tc-config>




When I tried to install the TIMs I get the below error,

Terracotta 3.7.0, as of 20120717-134631 (Revision unknown-20453 by cru...@rh5vmo112.terracotta.lan from 3.7.0)

WARNING: Failed to download remote data file.  Using cached copy at 'D:\User\AppData\Local\Temp\tim-get\index.xml.gz'.
Error message: Connection refused: connect
Parsing module: tim-ehcache-2.x:latest
Parsing module: tim-jboss-7.x:latest
Parsing module: tim-hibernate:latest
No module found matching: tim-hibernate:latest groupId=org.terracotta.modules
Installing tim-ehcache-2.x 1.6.0 and dependencies...
   DOWNLOAD FAILED: tim-ehcache-2.x 1.6.0
                    Attempt to download TIM file at http://www.terracotta.org/download/reflector/releases/org/terracotta/modules/tim-ehcache-2.x/
1.6.0/tim-ehcache-2.x-1.6.0.jar failed - Connection refused: connect
   DOWNLOAD FAILED: tim-ehcache-2.x-ui 1.6.0
                    Attempt to download TIM file at http://www.terracotta.org/download/reflector/releases/org/terracotta/modules/tim-ehcache-2.x-
ui/1.6.0/tim-ehcache-2.x-ui-1.6.0.jar failed - Connection refused: connect
   DOWNLOAD FAILED: tim-ehcache-2.x-hibernate-ui 1.6.0
                    Attempt to download TIM file at http://www.terracotta.org/download/reflector/releases/org/terracotta/modules/tim-ehcache-2.x-
hibernate-ui/1.6.0/tim-ehcache-2.x-hibernate-ui-1.6.0.jar failed - Connection refused: connect
   DOWNLOAD FAILED: terracotta-toolkit-1.6 5.0.0 [org.terracotta.toolkit]
                    Attempt to download TIM file at http://www.terracotta.org/download/reflector/releases/org/terracotta/toolkit/terracotta-toolk
it-1.6/5.0.0/terracotta-toolkit-1.6-5.0.0.jar failed - Connection refused: connect
Installing tim-ehcache-2.x 1.6.1 and dependencies...
   DOWNLOAD FAILED: tim-ehcache-2.x 1.6.1
                    Attempt to download TIM file at http://www.terracotta.org/download/reflector/releases/org/terracotta/modules/tim-ehcache-2.x/
1.6.1/tim-ehcache-2.x-1.6.1.jar failed - Connection refused: connect
   DOWNLOAD FAILED: tim-ehcache-2.x-ui 1.6.1
                    Attempt to download TIM file at http://www.terracotta.org/download/reflector/releases/org/terracotta/modules/tim-ehcache-2.x-
ui/1.6.1/tim-ehcache-2.x-ui-1.6.1.jar failed - Connection refused: connect
   DOWNLOAD FAILED: tim-ehcache-2.x-hibernate-ui 1.6.1

.........

Configuration in Jboss run.bat,

set TC_INSTALL_DIR=%TERRACOTTA_HOME%
set TC_CONFIG_PATH=%TERRACOTTA_HOME%\config\tc-config.xml
call %TC_INSTALL_DIR%\platform\bin\dso-env.bat -q
set JAVA_OPTS=%JAVA_OPTS% %TC_JAVA_OPTS%


In my Terracotta console i dont see my application enabled nor the Hibernate or EhCache being enabled



Kindly share where I'm going wrong..
Thanks in advance..

Fabien Sanglier

unread,
Mar 10, 2017, 10:39:52 AM3/10/17
to terracotta-oss
Hi,

The first thing I'd mention is that 3.7 is quite old... and although you may be able to make it work, I think you'd benefit greatly of using a newer package, like the latest TC 4.3.3 (http://terracotta.org/downloads/open-source/catalog)

Also, you don't need to download TIMs or specify them on the tc-config etc...
Herer is a sample and simple config for TC 4.3.3 (change hosts and ports as needed)

<?xml version="1.0" encoding="UTF-8" ?>
<tc:tc-config xmlns:tc="http://www.terracotta.org/config"
        xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-6.xsd">

        <servers>
                <mirror-group group-name="MirrorGroup1">
                        <server host="serverhost1" name="Server1">
                                <data>%(user.home)/terracotta/server-data/localserver1</data>
                                <logs>%(user.home)/terracotta/server-logs/localserver1</logs>
                                <tsa-port>9510</tsa-port>
                                <jmx-port>9520</jmx-port>
                                <tsa-group-port>9530</tsa-group-port>
                                <management-port>9540</management-port>
                                <dataStorage size="2g">
                                    <!-- offheap is an optional element that sets the maximum amount of offheap to 
                                        allocate to the server. 
                                        If the element is not present, offheap size will default to
                                        dataStorage size.
                                    -->
                                    <offheap size="2g"/>
                                </dataStorage>
                        </server>
                        <server host="serverhost2" name="Server2">
                                <data>%(user.home)/terracotta/server-data/localserver2</data>
                                <logs>%(user.home)/terracotta/server-logs/localserver2</logs>
                                <tsa-port>9510</tsa-port>
                                <jmx-port>9520</jmx-port>
                                <tsa-group-port>9530</tsa-group-port>
                                <management-port>9540</management-port>
                                <dataStorage size="2g">
                                    <!-- offheap is an optional element that sets the maximum amount of offheap to 
                                        allocate to the server. 
                                        If the element is not present, offheap size will default to
                                        dataStorage size.
                                    -->
                                    <offheap size="2g"/>
                                </dataStorage>
                        </server>
                </mirror-group>
                <garbage-collection>
                        <enabled>true</enabled>
                        <verbose>false</verbose>
                        <interval>3600</interval>
                </garbage-collection>
                <restartable enabled="false" />
                <client-reconnect-window>120</client-reconnect-window>
        </servers>

        <!-- Sets where the generated client logs are saved on clients. Note that 
                the exact location of Terracotta logs on client machines may vary based on 
                the value of user.home and the local disk layout. -->
        <clients>
            <logs>logs-%i</logs>
        </clients>
</tc:tc-config>


Regards,

Fabien

--
You received this message because you are subscribed to the Google Groups "terracotta-oss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terracotta-oss+unsubscribe@googlegroups.com.
To post to this group, send email to terracotta-oss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terracotta-oss/b36b78af-f298-4f10-8232-a5ba1474475f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Fabien Sanglier
fabiens...@gmail.com

lakshmanan bhaskar

unread,
Mar 11, 2017, 2:00:08 AM3/11/17
to terracotta-oss
Hi Fabien,

Thanks for your info.. I'll give it a try with 4.3.3 & let u know if i face any difficult.. Thanks..
To unsubscribe from this group and stop receiving emails from it, send an email to terracotta-os...@googlegroups.com.
To post to this group, send email to terraco...@googlegroups.com.



--
Fabien Sanglier
fabiens...@gmail.com
Reply all
Reply to author
Forward
0 new messages