[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Compass TIM and persistent-store  XML
Forum Index -> Terracotta for Spring
Author Message
jenner

neo

Joined: 10/12/2010 02:50:30
Messages: 3
Offline

Hi there,

I'm trying to use the Compass TIM with no positive results so far. For testing purposes I have only one TC server and one Compass app (a Spring webapp basically). The Compass config (part of my spring app context) looks like this:
Code:
         <compass:compass name="myCompass">
 	    <compass:connection>
 	        <compass:tc indexName="myindex" bufferSize="4096" flushRate="10"/>
 	    </compass:connection>
 	    <compass:searchEngine>
   			<compass:optimizer/>
         </compass:searchEngine>
 	    <compass:mappings>
         	<compass:class name="foo.bar.SomeModel"/>
         </compass:mappings>
 	<compass:settings>
 	    	<compass:setting name="compass.transaction.processor.tc.type"
 	    		value="org.compass.needle.terracotta.transaction.processor.TerracottaTransactionProcessorFactory"/>
 	    	<compass:setting name="compass.transaction.processor" value="tc"/>
 		<compass:setting name="compass.transaction.processor.tc.process" value="true"/>
 	    	<compass:setting name="compass.engine.cacheIntervalInvalidation" value="10" />
 	    </compass:settings>
 	</compass:compass>
 	
     <compass:context/>
 


The TC config:
Code:
 <?xml version="1.0" encoding="UTF-8"?>
 <tc:tc-config xmlns:tc="http://www.terracotta.org/config"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-5.xsd">
         <servers>
                 <server host="localhost" name="tcserver1">
                         <dso-port>9510</dso-port>
                         <jmx-port>9520</jmx-port>
                         <data>terracotta/server-data</data>
                         <logs>terracotta/server-logs</logs>
                         <statistics>terracotta/cluster-statistics</statistics>
                         <dso>
                                 <persistence>
                                         <mode>permanent-store</mode>
                                 </persistence>
                         </dso>
                 </server>
                 <update-check>
                         <enabled>true</enabled>
                 </update-check>
         </servers>
         <clients>
                 <logs>terracotta/client-logs</logs>
                 <modules>
                         <module group-id="org.compass-project" name="compass" version="2.2.0" />
                 </modules>
         </clients>
 </tc:tc-config>
 <


I added the compass jar to $TC_HOME/platform/modules/org/compass-project/compass/2.2.0/compass-2.2.0.jar. So the TC server is starting up just fine:
Code:
 /opt/terracotta-3.3.0$ ./bin/start-tc-server.sh -f tc-config.xml 
 2010-10-12 12:09:05,528 INFO - Terracotta 3.3.0, as of 20100716-150712 (Revision 15922 by cruise@su10mo5 from 3.3)
 2010-10-12 12:09:06,037 INFO - Successfully loaded base configuration from file at '/opt/terracotta-3.3.0/tc-config.xml'.
 2010-10-12 12:09:06,288 INFO - Log file: '/opt/terracotta-3.3.0/terracotta/server-logs/terracotta-server.log'.
 2010-10-12 12:09:08,708 INFO - Available Max Runtime Memory: 496MB
 2010-10-12 12:09:11,102 INFO - JMX Server started. Available at URL[service:jmx:jmxmp://0.0.0.0:9520]
 2010-10-12 12:09:17,011 INFO - Becoming State[ ACTIVE-COORDINATOR ]
 2010-10-12 12:09:17,094 INFO - Terracotta Server instance has started up as ACTIVE node on 0:0:0:0:0:0:0:0:9510 successfully, and is now ready for work.
 


I also added a couple of lines at the bottom of bin/catalina.sh of my tomcat6 instance:
Code:
 TC_INSTALL_DIR=/some/path/to/terracotta-3.3.0
 TC_CONFIG_PATH=localhost:9510
 . $TC_INSTALL_DIR/platform/bin/dso-env.sh -q
 export JAVA_OPTS="$JAVA_OPTS $TC_JAVA_OPTS"
 

The config is loaded successfully:
Code:
 2010-10-12 12:11:13,374 INFO - Terracotta 3.3.0, as of 20100716-150712 (Revision 15922 by cruise@su10mo5 from 3.3)
 2010-10-12 12:11:14,947 INFO - Successfully loaded base configuration from server at 'localhost:9510'.
 2010-10-12 12:11:17,511 INFO - Found boot JAR file at '/opt/terracotta-3.3.0/lib/dso-boot/dso-boot-hotspot_linux_160_20.jar'; validating...
 2010-10-12 12:11:17,789 INFO - Valid.
 

I can also see Compass debug messages in my tomcat log which suggest that compass is now using the TerracottaDirectory:
Code:
 DEBUG [main] terracotta.TerracottaDirectoryStore (TerracottaDirectoryStore.java:129) - Terracotta directory store configured with index [myindex], bufferSize [4096], flushRate [10], type [managed], concurrent [false]
 DEBUG [main] terracotta.TerracottaDirectory (TerracottaDirectory.java:84) - Using Terracota lock factory [org.compass.needle.terracotta.TerracottaLockFactory@c3362f]
 


So when I add some data to the index I can search for it just fine, i.e. I get the expected results - as long as I don't restart the compass+spring webapp. If I do - all indexed data is gone, so I guess the Compass TIM doesn't really connect to the TC server and stores everything in RAM. I can also see not a single client connection in TC dev console.

So, are there any obvious errors in my setup?

Any help is greatly appreciated!

TIA,
Igor
teck

seraphim
[Avatar]
Joined: 05/24/2006 15:03:25
Messages: 1128
Offline

I'll admit I know nothing about compass and/or terracotta clustered compass, but I think you're having generic terracotta problems first.

If you never see a connected client in the dev console (or any objects under the Platform->Clustered Heap->Object browser) then nothing is getting clustered -- which fits with your observation (data is lost on app restart).

When you start the actual VM that runs your spring web app does it repeat the lines like these?
2010-10-12 12:11:13,374 INFO - Terracotta 3.3.0, as of 20100716-150712 (Revision 15922 by cruise@su10mo5 from 3.3)
2010-10-12 12:11:14,947 INFO - Successfully loaded base configuration from server at 'localhost:9510'.
 


If not then likely the your JAVA_OPTS/TC_JAVA_OPTS isn't making it to the actual java command line. You can use ps to verify the command line once the app is started

Tim Eck (terracotta engineer)
jenner

neo

Joined: 10/12/2010 02:50:30
Messages: 3
Offline

Well we finally figured it out:

1. Make sure to load the -Xbootclasspath in your tomcat environment before anything else is loaded, I just added the following lines right before the last line (exec "$PRGDIR"/"$EXECUTABLE" start "$@") in $TOMCAT/bin/startup.sh:
Code:
 export TC_INSTALL_DIR=/some/path/to/terracotta-3.3.0
 export TC_HOME=$TC_INSTALL_DIR
 export TC_CONFIG_PATH=localhost:9510
 . $TC_INSTALL_DIR/platform/bin/dso-env.sh -q
 export JAVA_OPTS="$JAVA_OPTS $TC_JAVA_OPTS"
 

2. Install the tomcat TIM and add it to your tc-config.xml. This is an important dependency, otherwise the compass TIM won't be able to communicate with the TC server (a classloader issue?)

My main problem here was the lack of infos for this kind of setup (spring+compass+tomcat)... I can compile a doc describing all steps for an FAQ entry in case you're interested.
ilevy

consul

Joined: 04/16/2008 10:26:42
Messages: 357
Offline

For starters, would you mind posting that info to this forum?
jenner

neo

Joined: 10/12/2010 02:50:30
Messages: 3
Offline

ilevy wrote:
For starters, would you mind posting that info to this forum?  


It's just my first posting (i.e. the config settings) with minor corrections in my second one.
robincro

neo

Joined: 03/29/2011 00:36:44
Messages: 1
Location: 1905 Willow Ave, Weehawken, NJ 07086
Offline

Thanks for the ideas given in forum.This wll help in finding the right direction to start.


PCB Assemblies
 
Forum Index -> Terracotta for Spring
Go to:   
Powered by JForum 2.1.7 © JForum Team