Search code examples
deploymentglassfishamazon-ec2failover

Redeploy/Failover for Glassfish cluster on EC2?


I have a Tapestry application (WAR, no EJB) that ...

  • ... I want to deploy on 2 EC2 small instances (for failover).
  • ... uses Spring Security
  • ... is stateful (very small session state)
  • ... should be deployed on Glassfish 3.1 (seems to have best cluster support?)
  • ... and has an elastic load balancer with sticky session in front of it

How can I configure a cluster to achieve minimal ('no') interruptions for the user experience in case A) a node fails and B) I deploy a new version?


Solution

  • Everything is explained here: http://download.oracle.com/docs/cd/E18930_01/html/821-2426/docinfo.html#scrolltoc

    Basically, you setup a DAS (=master), which control nodes with instances on it. You could do all of this on the same machine (1 DAS, 1 node with multiple instances), although it would be a good idea to have at least 2.

    You should then have at least one load balancer (apache, physical load balancer, whatever).

    A) if a node fails, the load balancer can redirect all traffic to the other node

    B)

    • deploy application, disabled, with new version (see "application versioning")
    • mark server A as unavailable
    • enable the new version on server A
    • mark server A as available and server B as unavailable
    • enable the new version on server B
    • mark server B as avalilable