BidVertiser

Monday, April 16, 2012

Starting Terracotta Server as a Windows service

<>There's an easy way to set up Terracotta server as Windows service using the open source Java Service Wrapper.
I've used their Integration Method 1, which uses a wrapper WrapperSimpleApp to run Terracotta server main class com.tc.server.TCServerMain.
First, just download and install the latest version wrapper-windows-x86-32-3.3.5. Then make copy of conf/wrapper.conf and name it TerracottaServer.conf.
Fill out these needed properties in TerracottaServer.conf:
  1. for logging
    wrapper.java.command.loglevel=INFO
  2. Method 1 main class
    wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
  3. classpath
  4. (1) is for WrapperSimpleApp
  5. (2) is for Terracotta Server - You'll need to fix up the path for your own use
    wrapper.java.classpath.1=../lib/wrapper.jar
    wrapper.java.classpath.2=d:/work/builds/terracotta-3.5.1/lib/tc.jar
  6. Java Additional Parameters
    1. NOTE: -server option only works with a JDK, not with JRE
      wrapper.java.additional.1=-server wrapper.java.additional.2=-XX:+HeapDumpOnOutOfMemoryError
      wrapper.java.additional.3=-Dcom.sun.management.jmxremote
      wrapper.java.additional.4=-Dtc.install-root=d:/work/builds/terracotta-3.5.1
  7. Initial Java Heap Size (in MB)
    wrapper.java.initmemory=512
  8. Maximum Java Heap Size (in MB)
    wrapper.java.maxmemory=512
  9. Application parameters. This is where you specify TC server main class
    wrapper.app.parameter.1=com.tc.server.TCServerMain
That's pretty much all you need. There are Batch scripts in the "bin" folder of the wrapper installation where you can install/uninstall your service. Just make sure you modify those scripts to point to TerracottaServer.conf file you made earlier.
Once you have the service install, you can start/stop the service by using Windows services manager or by using the scripts. There will be a log of the run under "/logs"