Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

top

6.7. Configuring Failover Deployments

This chapter will demonstrate how to configure failover deployments.

Simple

...

lock file

The simple lock file mechanism is intended for failover configurations where instances reside on the same host machine.

To use this feature the following must be set , edit the $KARAF_HOME/etc/system.properties file as follows on each system in the master/slave setup:

  • $SERVICEMIX_HOME/etc/system.properties file updated to reflect the below entries.
No Format

servicemix.lock=true

JDBC Locking

...

Note: Ensure that the karaf.lock.dir property points to the same directory for both the master and slave instance, so that the slave can only acquire the lock when the master releases it.

JDBC locking

The JDBC locking mechanism is intended for failover configurations where instances exist on separate machines. In this deployment, the master instance holds a lock on a Karaf locking table hosted on a database. If the master loses the lock, a waiting slave process gains access to the locking table and fully starts its container.

To use this feature, do the following To use this feature the following must be set on each system in the master/slave setup:

  • Classpath updated Update the classpath to include the JDBC driver.
  • Update the $KARAF_HOME/bin/karaf script to have unique JMX remote port set if instances reside on the same host
  • Update the $KARAF$SERVICEMIX_HOME/etc/system.properties file updated to reflect the below entries.

...

  • as follows:

...

Note:

  • Will fail if jdbc JDBC driver is not on classpath.
  • The database name "sample" will be created if it does not exist on the dbdatabase.
  • First SMX4 The first Karaf instance to acquire the locking table is the master instance.
  • If the connection to the DB database is lost then , the master instance will attempt tries to gracefully shutdown, allowing a slave instance to become master when the DB database service is restored. The former master will require manual restart.

JDBC locking on Oracle

If you are using Oracle as your database in a JDBC locking scenario, the karaf.lock.class property in the $KARAF_HOME/etc/system.properties file must point to org.apache.felix.karaf.main.OracleJDBCLock.

Otherwise, configure the system.properties file as normal for your setup, for example:

...

As with the default JDBC locking setup, the Oracle JDBC driver JAR file must be in your classpath. You can ensure this by copying the ojdbc14.jar into Karaf's lib folder before starting Karaf.

Note: The karaf.lock.jdbc.url requires an active SID, which means you must manually create a database instance before using this particular lock.

locklevel

Container-level locking

Container-level locking allows bundles to be preloaded into the slave kernel instance in order to provide faster failover performance. Container-level locking is supported in both the simple file and JDBC locking mechanisms.

To implement container-level locking, add the following to the $KARAF_HOME/etc/system.properties file on each system in the master/slave setup:

...

The karaf.log.level property tells the Karaf instance how far up the boot process to bring the OSGi container. Bundles assigned the same start level or lower will then also be started in that Karaf instance.

Bundle start levels are specified in $KARAF_HOME/etc/startup.properties, in the format jar.name=level. The core system bundles have levels below 50, where as user bundles have levels greater than 50.

Level

Behavior

1

A 'cold' standby instance. Core bundles are not loaded into container. Slaves will wait until lock acquired to start server.

<50

A 'hot' standby instance. Core bundles are loaded into the container. Slaves will wait until lock acquired to start user level bundles. The console will be accessible for each slave instance at this level.

>50

This setting is not recommended as user bundles will be started.

Note: When using a 'hot' spare on the same host you need to set the JMX remote port to a unique value to avoid bind conflicts. You can edit the Karaf start script to include the following:

...

#top

...