Getting Started with Sailfin clustering and MySQL Cluster

Sailfin is the open source implementation of Sun Glassfish Communications Server which basically is Glassfish with support for SIP servlets. It allows you to create converged communication services and has some interesting features that together with MySQL Cluster creates very a nice highly available and high performance service execution environment (a white paper on this at mysql.com). 

We are going to setup a simple 2 Sailfin instance clustering with a 2 Data Node MySQL Cluster all running on localhost to start with. The deployment diagram has only a single SQL Node so there is no failover. It can easily be added using MySQL Proxy and additional SQL Nodes, see here for an example.

sailfin cluster + mysql cluster

For installing MySQL Cluster see Quickstart with MySQL Cluster.

Installing Sailfin

Let's start by downloading the open source distribution of Sailfin from https://sailfin.dev.java.net/downloads/download_os.html

The one I ended downloading was sailfin-installer-v1-b60g-darwin.jar

Make sure you have at least JDK 1.5 update 8, JDK 1.6 is recommend.

Installation steps below ripped from Sailfin's site.

  1. $ java -Xmx256m -jar sailfin-installer-v1-b60g-darwin.jar
  2. $ cd sailfin
  3. $ chmod -R +x lib/ant/bin
  4. $ lib/ant/bin/ant -f setup-cluster.xml
    Install clustering support.
Create Sailfin Cluster

We are going to setup a 2 sailflin instance cluster on localhost which means that we'll end up running 3 Sailfin instances and 1 Sailfin node agent. One Sailfin instance is the DAS, i.e., the Domain Administration Server which provisions applications, configurations and other resources for the other Sailfin instances.

  1. Add Sailfin binaries to the path.
    $ export PATH <sailfin install dir>/bin:$PATH
  2. Create a domain (use adminadmin as the admin password, for master password accept the default)
    $ asadmin create-domain --user admin --adminport 4848 sailfin-cluster-domain
  3. Start the created domain
    $ asadmin start-domain --user admin sailfin-cluster-domain
  4. Create a node agent per host
    $ asadmin create-node-agent --host localhost agent_localhost
  5. Start the node agent
    $ asadmin start-node-agent agent_localhost
  6. Logon to admin pages http://localhost:4848 (user: admin, password: adminadmin) and perform below steps via web or do it manually
  7. Create/define a cluster
    $ asadmin create-cluster sailfin-cluster
  8. Add/create Sailfin instances to the created cluster
    $ asadmin create-instance --nodeagent agent_localhost --cluster sailfin-cluster instance1
    $ asadmin create-instance --nodeagent agent_localhost --cluster sailfin-cluster instance2
  9. Start the created cluster
    $ asadmin start-cluster sailfin-cluster

Logon to the admin pages, http://localhost:4848 and you should see something like this.

sailfin admin

Create JDBC Resources for MySQL

We need MySQL Connector/J, the latest version as of today is 5.1.17. We need to copy
mysql-connector-java-5.1.7-bin.jar to <sailfin installation dir>/domains/sailfin-cluster-domain/lib/ext and then restart our sailfin-cluster-domain (asadmin stop-domain <name> followed by asadmin start-domain <name>).

Once that's done we can setup a JDBC connection pool for connecting to MySQL using the web admin (http://localhost:4848).

JDBC Connection Pool

First click on Connection Pools to create a new JDBC Connection pool.

For example name the pool, MySQLPool and choose the proper DB vendor, MySQL in this case.

Using default settings however we need to set some properties. Look for these to set:

  • ServerName
  • DatabaseName
  • User
  • Password

Or just find the URL property and set it to: jdbc:mysql://localhost:3306/test?user=<dbuser>&password=<dbpass>

Save the new connection pool and then we need to verify that it works. So select it again, MySQLPool.

And click on Ping.

You should get 'Ping Succeeded' message.

Finally, we need to create a JDBC resource for our apps to use. Click on JDBC Resources and create a new MySQL JDBC resource.

Let's name the JNDI name to MySQLCluster and choose the MySQLPool as the connection pool to use. Also select our sailfin-cluster as the target for this resource.

That's all. Now we have a MySQL JDBC resource to use for our applications.

Sailfin and MySQL Cluster links

Project Sailfin
The Aquarium
Getting Started with MySQL Cluster
JOHAN ANDERSSON'S CLUSTER AND HA BLOB
severalnines.com
Big DBA Head!
Mikael Ronström's blog
Jonas Oreland's Cluster blog

 

Tags: 

Add new comment

Plain text

  • No HTML tags allowed.
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.