Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
XML
XML
borderStylesolid
  <!-- We use 0.0.0.0 per AMQ-2094 -->
  <amq:transportConnectors>
     <amq:transportConnector uri="tcp://localhost0.0.0.0:61616"/>
  </amq:transportConnectors>

  <amq:persistenceAdapter>
      <amq:journaledJDBCamqPersistenceAdapter journalLogFilesdirectory="5" dataDirectory="/file:<shared>/data/amq"/>
  </amq:persistenceAdapter>

4) Edit <servicemix2>/conf/activemq.xml and verify the ActiveMQ peristence adapter configuration.

Code Block
XML
XML
borderStylesolid
  <amq:transportConnectors>
     <amq:transportConnector uri="tcp://localhost0.0.0.0:61616"/>
  </amq:transportConnectors>

  <amq:persistenceAdapter>
      <amq:journaledJDBCamqPersistenceAdapter journalLogFilesdirectory="5" dataDirectory="/file:<shared>/data/amq"/>
  </amq:persistenceAdapter>

Info
titlePlease Note
  • Both configurations use the exact same dataDirectory.
  • Both configurations use the exact same transportConnector configuration. There will NOT be a port conflict as the slave's slaves {{transportConnectorTransportConnector}}s will not be activated until a failover event occurs.
  • This example is for a shared filesystem master/slave. For shared JDBC master/slave you would modify the persistence adapter so that both instances point to the same dataSource, for example:
Code Block
XML
XML
borderStylesolid
<amq:persistenceAdapter>
      <amq:jdbcPersistenceAdapter dataSource="#oracle-ds" /> 
</amq:persistenceAdapter>

<bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
 	 <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> 
  <property name="url" value="jdbc:oracle:thin:@192.168.1.4:1521:mydbname" /> 
  <property name="username" value="smix_node1_ha" /> 
  <property name="password" value="smix_node1_ha" /> 
  <property name="poolPreparedStatements" value="true" /> 
</bean>

  • With ServiceMix 4, you will be able to use SERVICEMIX_BASE to specify the <servicemix>/conf directory so two installs will not be necessary.

...

As Servicemix leverages ActiveMQ to provide clustering functionality, you have a few choices in terms of how you configure the {{networkConnector}}*NetworkConnector*s:

1) Static Network Connectors

With a static configuration, each networkConnector NetworkConnector in the cluster is wired up explicitly via
<servicemix>/conf/activemq.xml.

Here's an example of a static discovery configuration:

Code Block
XML
XML
borderStylesolid

<!-- We are setting our brokerName to be unique for this container -->
<amq:broker id="broker" brokerName="host1_broker1" depends-on="jmxServer">

   ....

   <networkConnectors>
      <networkConnector name="host1_to_host2" uri="static://(tcp://host2:61616)"/>

      <!-- Here's what it would like for a three container network -->
      <!-- (Note its not necessary to list our own hostname in the uri list) -->
      <!-- networkConnector name="host1_to_host2_host3" uri="static://(tcp://host2:61616,tcp://host3:61616)"/ -->

   </networkConnectors>

</amq:broker>

Info
titleCluster Configuration Conventions
  • Don't use static and multicast at the same time. If you enable static {{networkConnector}}s then disable multicast and vice versa.
  • When using a network of containers in <servicemix>/activemq.xml ensure that the brokerName attribute is unique for each node in the cluster. This is to ensure that the instances in the network can uniquely identify each other.
  • Ensure the jbi container name configured in <servicemix>/servicemix.xml is unique to the cluster.
  • If you are also using a HA configuration then the brokerName attribute should be the same for both the master and the slave.
  • When configuring a network of containers you need to to ensure that you have a unique persistent stores for each ACTIVE instance. If you are using a JDBC datasource, this means a separate database for each ACTIVE instance.
Code Block
XML
XML
borderStylesolid
<property name="url" value="jdbc:mysql://localhost/broker_activemq_host1?relaxAutoCommit=true"/>
  • It is possible to setup a network of containers on the same host. You will need to change the JMS ports and transportConnector ports to avoid port conflicts.

Edit the <servicemix>/conf/servicemix.properties, changing the rmi.port and activemq.port as appropriate.

Code Block
borderStylesolid
rmi.port                   = 1098
rmi.host                   = localhost
jmx.url                    = service:jmx:rmi:///jndi/rmi://${rmi.host}:${rmi.port}/jmxrmi

activemq.port              = 61616
activemq.host              = localhost
activemq.url               = tcp://${activemq.host}:${activemq.port}

...

If you have multicast enabled on your network and you have multicast configured in the <servicemix>/conf/activemq.xml, then when the two containers are started they should detect each other and transparently connect to one another.

...