Thursday, 27 May 2010

Shibboleth IdP cluster with Terracotta

Even if strongly discouraged, I gave a try to Shibboleth clustering with Terracotta. Definitive instruction at: https://spaces.internet2.edu/display/SHIB2/IdPCluster.

I managed to have cluster working only with terracotta-3.1.1, with is a bit old, as newer version is 3.2.1. To download terracotta-3.1.1 I had to craft by hand the download url, after the require registration.

Instruction are so clear that I'm not going to add anything. I recommend to create beforhand the directories:
$IDP_HOME/cluster
$TC_HOME/logs

Here is my startup script for debian:
#!/bin/sh

JAVA_HOME=/usr/lib/jvm/java-6-sun
TC_HOME=/opt/terracotta
TC_CONFIG=/opt/shibboleth-idp/conf/tc-config.xml


# where to put stdout/stderr logs
TC_LOGS=$TC_HOME/logs

# user to run tc as
TC_USER=root
# the identity of this node
TC_SERVER=node1

JAVA_OPTS="\
-verbose:gc \
-XX:+PrintGCDetails \
-XX:-TraceClassUnloading \
-Xmx512M \
-Xms512M \
-XX:MaxGCPauseMillis=5000 \
-XX:+UseParallelOldGC \
-XX:+PrintCommandLineFlags \
"


export JAVA_HOME
export JAVA_OPTS
 
start () {
 echo "Starting Terracotta Server as " ${TC_SERVER}
  ${TC_HOME}/bin/start-tc-server.sh -n ${TC_SERVER} -f ${TC_CONFIG}  > ${TC_LOGS}/terracotta.log 2>&1 &
#        $TC_INSTALL_DIR/bin/start-tc-server.sh -f $TC_CONFIG_PATH &
}
stop () {
 echo "Stopping Terracotta Server ..."
 ${TC_HOME}/bin/stop-tc-server.sh 2>&1 > ${TC_LOGS}/terracotta.log &

#        $TC_INSTALL_DIR/bin/stop-tc-server.sh -f $TC_CONFIG_PATH  -n `hostname -s` &
}
 
case "$1" in
  start)
      start
      ;;
  stop)
      stop
      ;;
  restart)
      stop
      sleep 10
      start
      ;;
  *)
    echo "Usage terracotta start|stop|restart"
    exit 1;;
esac
 
exit $?

Of course TC_SERVER=node1 should reflect your configuration.

The flags to JAVA_OPTS were gathered in the mailing list.

Next it is necessary to modify tomcat6 to join terracotta. I didn't find a way to put configuration in /etc/default/tomcat, so I modified /etc/init.d/tomcat6 in CATALINA_OPTS which now reads:
CATALINA_OPTS="-Xms256M -Xmx512M -XX:MaxPermSize=192M -server -Dtc.install-root=/opt/terracotta -Dtc.config=/opt/shibboleth-idp/conf/tc-config.xml -Xbootclasspath/p:/opt/terracotta/lib/dso-
boot/dso-boot-hotspot_linux_160_12.jar"

No comments: