...
Code Block |
---|
|
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:61616"/>
</amq:transportConnectors>
<amq:persistenceAdapter>
<amq:journaledJDBC journalLogFiles="5" dataDirectory="/<shared>/data/amq"/>
</amq:persistenceAdapter>
|
4) Edit <servicemix2>/conf/activemq.xml
and verify the ActiveMQ peristence adapter configuration.
...
Info |
---|
|
- 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 |
---|
|
<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:
...
Info |
---|
title | Cluster 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.
- 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 |
---|
|
<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 |
---|
|
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.
...