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.
For installing MySQL Cluster see Quickstart with MySQL Cluster.
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.
$ java -Xmx256m -jar sailfin-installer-v1-b60g-darwin.jar
$ cd sailfin
$ chmod -R +x lib/ant/bin
$ 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.
- Add Sailfin binaries to the path.
$ export PATH <sailfin install dir>/bin:$PATH
- 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
- Start the created domain
$ asadmin start-domain --user admin sailfin-cluster-domain
- Create a node agent per host
$ asadmin create-node-agent --host localhost agent_localhost
- Start the node agent
$ asadmin start-node-agent agent_localhost
- Logon to admin pages http://localhost:4848 (user: admin, password: adminadmin) and perform below steps via web or do it manually
- Create/define a cluster
$ asadmin create-cluster sailfin-cluster
- 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
- Start the created cluster
$ asadmin start-cluster sailfin-cluster
Logon to the admin pages, http://localhost:4848 and you should see something like this.
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:
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