Hello,
i am a litte bit further with my problem.
The first problem was i did a wrong setup. I wanted an active-active Cluster with a shared filesystem. Ok this is not possible.
Now I decided an active-passive Cluster with a shared file system.
First I started with one virtual Server (192.168.206.132) on which i installed two hornetq instances. Following setup:
Instance1
start.sh
...
###############################################################################################
# JVM Settings
export JVM_ARGS="-XX:+UseParallelGC -XX:+UseFastAccessorMethods"
export JVM_ARGS="$JVM_ARGS -Xms1024M -Xmx1024M"
export JVM_ARGS="$JVM_ARGS -Djava.library.path=."
export JVM_ARGS="$JVM_ARGS -Djava.net.preferIPv4Stack=true"
export JVM_ARGS="$JVM_ARGS -Dfile.encoding=utf-8"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.port=13000"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.ssl=false"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.authenticate=false"
###############################################################################################
# HornetQ Config
#export JVM_ARGS="$JVM_ARGS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
export JVM_ARGS="$JVM_ARGS -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties"
export JVM_ARGS="$JVM_ARGS -Dhornetq.config.dir=$CONFIG_DIR"
export JVM_ARGS="$JVM_ARGS -Ddata.dir=/usr/java/hornetq/dev/data/test1"
export JVM_ARGS="$JVM_ARGS -Dcluster.user=password"
export JVM_ARGS="$JVM_ARGS -Dcluster.password=user"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host1=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host1.port=15445"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host2=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host2.port=15446"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.acceptor.host=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.acceptor.host.port=15445"
export JVM_ARGS="$JVM_ARGS -Djnp.port=11099"
export JVM_ARGS="$JVM_ARGS -Djnp.host=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Djnp.rmiPort=11098"
export JVM_ARGS="$JVM_ARGS -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"
export JVM_ARGS="$JVM_ARGS -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"
...
hornetq-configuration.xml
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
<clustered>true</clustered>
<backup>false</backup> # second instance true
<shared-store>true</shared-store>
<allow-failback>true</allow-failback>
<failover-on-shutdown>true</failover-on-shutdown>
<journal-type>ASYNCIO</journal-type>
<paging-directory>${data.dir:../data}/paging</paging-directory>
<bindings-directory>${data.dir:../data}/bindings</bindings-directory>
<journal-directory>${data.dir:../data}/journal</journal-directory>
<journal-min-files>10</journal-min-files>
<large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
<cluster-user>${cluster.user:clusteruser}</cluster-user>
<cluster-password>${cluster.password:password}</cluster-password>
<!-- Connectors -->
<connectors>
<connector name="netty-connector-host1">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.connector.host1:server1}"/>
<param key="port" value="${hornetq.remoting.netty.connector.host1.port:5445}"/>
</connector>
<!-- Static connector to the HornetQ Server 2 -->
<connector name="netty-connector-host2">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.connector.host2:server2}"/>
<param key="port" value="${hornetq.remoting.netty.connector.host2.port:5445}"/>
</connector>
</connectors>
<!-- Acceptors -->
<acceptors>
<acceptor name="netty-acceptor">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.acceptor.host:server1}"/>
<param key="port" value="${hornetq.remoting.netty.acceptor.host.port:5455}"/>
</acceptor>
</acceptors>
<cluster-connections>
<cluster-connection name="DevCluster">
<address>jms</address>
<connector-ref>netty-connector-host1</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<forward-when-no-consumers>true</forward-when-no-consumers>
<max-hops>1</max-hops>
<static-connectors>
<connector-ref>netty-connector-host2</connector-ref>
</static-connectors>
</cluster-connection>
</cluster-connections>
Instance2
start.sh
...
###############################################################################################
# JVM Settings
export JVM_ARGS="-XX:+UseParallelGC -XX:+UseFastAccessorMethods"
export JVM_ARGS="$JVM_ARGS -Xms1024M -Xmx1024M"
export JVM_ARGS="$JVM_ARGS -Djava.library.path=."
export JVM_ARGS="$JVM_ARGS -Djava.net.preferIPv4Stack=true"
export JVM_ARGS="$JVM_ARGS -Dfile.encoding=utf-8"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.port=23000"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.ssl=false"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.authenticate=false"
###############################################################################################
# HornetQ Config
#export JVM_ARGS="$JVM_ARGS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
export JVM_ARGS="$JVM_ARGS -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties"
export JVM_ARGS="$JVM_ARGS -Dhornetq.config.dir=$CONFIG_DIR"
export JVM_ARGS="$JVM_ARGS -Ddata.dir=/usr/java/hornetq/dev/data/test1"
export JVM_ARGS="$JVM_ARGS -Dcluster.user=password"
export JVM_ARGS="$JVM_ARGS -Dcluster.password=user"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host1=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host1.port=25445"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host2=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host2.port=25446"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.acceptor.host=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.acceptor.host.port=25445"
export JVM_ARGS="$JVM_ARGS -Djnp.port=21099"
export JVM_ARGS="$JVM_ARGS -Djnp.host=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Djnp.rmiPort=21098"
export JVM_ARGS="$JVM_ARGS -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"
export JVM_ARGS="$JVM_ARGS -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"
...
EVERYTHING WORKS FINE!
Then I tried with two virtual Server (192.168.206.132 and 192.168.206.133) on which i installed one hornetq instance. Following setup:
Server 1
start.sh
...
###############################################################################################
# JVM Settings
export JVM_ARGS="-XX:+UseParallelGC -XX:+UseFastAccessorMethods"
export JVM_ARGS="$JVM_ARGS -Xms1024M -Xmx1024M"
export JVM_ARGS="$JVM_ARGS -Djava.library.path=."
export JVM_ARGS="$JVM_ARGS -Djava.net.preferIPv4Stack=true"
export JVM_ARGS="$JVM_ARGS -Dfile.encoding=utf-8"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.port=3000"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.ssl=false"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.authenticate=false"
###############################################################################################
# HornetQ Config
#export JVM_ARGS="$JVM_ARGS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
export JVM_ARGS="$JVM_ARGS -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties"
export JVM_ARGS="$JVM_ARGS -Dhornetq.config.dir=$CONFIG_DIR"
export JVM_ARGS="$JVM_ARGS -Ddata.dir=/usr/java/hornetq/dev/data/test2"
export JVM_ARGS="$JVM_ARGS -Dcluster.user=password"
export JVM_ARGS="$JVM_ARGS -Dcluster.password=user"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host1=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host1.port=15445"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host2=192.168.206.133"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host2.port=15446"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.acceptor.host=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.acceptor.host.port=15445"
export JVM_ARGS="$JVM_ARGS -Djnp.port=11099"
export JVM_ARGS="$JVM_ARGS -Djnp.host=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Djnp.rmiPort=11098"
export JVM_ARGS="$JVM_ARGS -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"
export JVM_ARGS="$JVM_ARGS -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"
...
hornetq-configuration.xml
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
<clustered>true</clustered>
<backup>false</backup> # second server true
<shared-store>true</shared-store>
<allow-failback>true</allow-failback>
<failover-on-shutdown>true</failover-on-shutdown>
<journal-type>ASYNCIO</journal-type>
<paging-directory>${data.dir:../data}/paging</paging-directory>
<bindings-directory>${data.dir:../data}/bindings</bindings-directory>
<journal-directory>${data.dir:../data}/journal</journal-directory>
<journal-min-files>10</journal-min-files>
<large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
<cluster-user>${cluster.user:clusteruser}</cluster-user>
<cluster-password>${cluster.password:password}</cluster-password>
<!-- Connectors -->
<connectors>
<connector name="netty-connector-host1">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.connector.host1:server1}"/>
<param key="port" value="${hornetq.remoting.netty.connector.host1.port:5445}"/>
</connector>
<!-- Static connector to the HornetQ Server 2 -->
<connector name="netty-connector-host2">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.connector.host2:server2}"/>
<param key="port" value="${hornetq.remoting.netty.connector.host2.port:5445}"/>
</connector>
</connectors>
<!-- Acceptors -->
<acceptors>
<acceptor name="netty-acceptor">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.acceptor.host:server1}"/>
<param key="port" value="${hornetq.remoting.netty.acceptor.host.port:5455}"/>
</acceptor>
</acceptors>
<cluster-connections>
<cluster-connection name="DevCluster">
<address>jms</address>
<connector-ref>netty-connector-host1</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<forward-when-no-consumers>true</forward-when-no-consumers>
<max-hops>1</max-hops>
<static-connectors>
<connector-ref>netty-connector-host2</connector-ref>
</static-connectors>
</cluster-connection>
</cluster-connections>
Server2
start.sh
...
###############################################################################################
# JVM Settings
export JVM_ARGS="-XX:+UseParallelGC -XX:+UseFastAccessorMethods"
export JVM_ARGS="$JVM_ARGS -Xms1024M -Xmx1024M"
export JVM_ARGS="$JVM_ARGS -Djava.library.path=."
export JVM_ARGS="$JVM_ARGS -Djava.net.preferIPv4Stack=true"
export JVM_ARGS="$JVM_ARGS -Dfile.encoding=utf-8"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.port=3000"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.ssl=false"
export JVM_ARGS="$JVM_ARGS -Dcom.sun.management.jmxremote.authenticate=false"
###############################################################################################
# HornetQ Config
#export JVM_ARGS="$JVM_ARGS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
export JVM_ARGS="$JVM_ARGS -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties"
export JVM_ARGS="$JVM_ARGS -Dhornetq.config.dir=$CONFIG_DIR"
export JVM_ARGS="$JVM_ARGS -Ddata.dir=/usr/java/hornetq/dev/data/test2"
export JVM_ARGS="$JVM_ARGS -Dcluster.user=password"
export JVM_ARGS="$JVM_ARGS -Dcluster.password=user"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host1=192.168.206.133"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host1.port=15445"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host2=192.168.206.132"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.connector.host2.port=15446"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.acceptor.host=192.168.206.133"
export JVM_ARGS="$JVM_ARGS -Dhornetq.remoting.netty.acceptor.host.port=15445"
export JVM_ARGS="$JVM_ARGS -Djnp.port=11099"
export JVM_ARGS="$JVM_ARGS -Djnp.host=192.168.206.133"
export JVM_ARGS="$JVM_ARGS -Djnp.rmiPort=11098"
export JVM_ARGS="$JVM_ARGS -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"
export JVM_ARGS="$JVM_ARGS -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"
...
PROBLEM
Both server are starting at the same time, the second server is not waiting for an event (crash or shutdown) on the first one.
Does someone have an idea why this happens?