5 Replies Latest reply on Jun 20, 2011 4:57 PM by Sami GH

    HornetQ cluster connection using VPN

    Sami GH Newbie

      Hi All,

       

      I am having a problem with connecting to HornetQ cluster using VPN.

       

      In a non-clustered mode, I can connect to a non-clustered Server using jnp:\\address:1099. But in a clustered mode, I am unable to connect to HornetQ using jnp:\\address:1099 or group address and group port. I always get a timeout exception when trying to connect to the cluster remotely.

       

      My configuration are similar to the symmetric cluster example in HornetQ 2.1.2.

       

      Is there any way to solve this issue and being able to send/receive the messages using VPN?

       

      Thanks,

       

      Sami

        • 1. Re: HornetQ cluster connection using VPN
          Clebert Suconic Master

          It doesn't seem related to HornetQ.

           

          If it is something on HornetQ, you are messing up some of your configs.

           

           

          You would need to ask something more specific.

          • 2. Re: HornetQ cluster connection using VPN
            Sami GH Newbie

            Thanks for the reply,

             

            If it is not a problem related to HornetQ, is there some kind of limitations in VPN that forbids it to connect in clustered mode?

             

            Please find below the configurations that I have to exclude the problems with HornetQ configurations:

             

            hornetq-beans.xml

             

            <?xml version="1.0" encoding="UTF-8"?>
            
            <deployment xmlns="urn:jboss:bean-deployer:2.0">
            
               <bean name="Naming" class="org.jnp.server.NamingBeanImpl"/>
            
               <!-- JNDI server. Disable this if you don't want JNDI -->
               <bean name="JNDIServer" class="org.jnp.server.Main">
                  <property name="namingInfo">
                     <inject bean="Naming"/>
                  </property>
                  <property name="port">1499</property>
                  <property name="bindAddress">10.10.10.112</property>
                  <property name="rmiPort">1498</property>
                  <property name="rmiBindAddress">10.10.10.112</property>
               </bean>
            
               <!-- MBean server -->
               <bean name="MBeanServer" class="javax.management.MBeanServer">
                  <constructor factoryClass="java.lang.management.ManagementFactory"
                               factoryMethod="getPlatformMBeanServer"/>
               </bean> 
            
               <!-- The core configuration -->
               <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration">
               </bean>
            
                <!-- The security manager -->
               <bean name="HornetQSecurityManager" class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl">
                  <start ignored="true"/>
                  <stop ignored="true"/>
               </bean>
            
                <!-- The core server -->
               <bean name="HornetQServer" class="org.hornetq.core.server.impl.HornetQServerImpl">
                  <constructor>
                     <parameter>
                        <inject bean="Configuration"/>
                     </parameter>
                     <parameter>
                        <inject bean="MBeanServer"/>
                     </parameter>
                     <parameter>
                        <inject bean="HornetQSecurityManager"/>
                     </parameter>        
                  </constructor>
                  <start ignored="true"/>
                  <stop ignored="true"/>
               </bean>
               
               <!-- The JMS server -->
               <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
                  <constructor>         
                     <parameter>
                        <inject bean="HornetQServer"/>
                     </parameter>         
                  </constructor>
               </bean>
              
               
            </deployment>
            

             

            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>
               
               <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>
            
               <connectors>      
                  <connector name="netty">
                     <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                     <param key="host"  value="${hornetq.remoting.netty.host:10.10.10.112}"/>
                     <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
                  </connector>
                  
                  <connector name="netty-throughput">
                     <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                     <param key="host"  value="${hornetq.remoting.netty.host:10.10.10.112}"/>
                     <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>
                     <param key="batch-delay" value="50"/>
                  </connector>
               </connectors>
            
               <acceptors>
                  <acceptor name="netty">
                     <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
                     <param key="host"  value="${hornetq.remoting.netty.host:10.10.10.112}"/>
                     <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
                  </acceptor>
                  
                  <acceptor name="netty-throughput">
                     <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
                     <param key="host"  value="${hornetq.remoting.netty.host:10.10.10.112}"/>
                     <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>
                     <param key="batch-delay" value="50"/>
                     <param key="direct-deliver" value="false"/>
                  </acceptor>
               </acceptors>
            
               <broadcast-groups>
                  <broadcast-group name="MY-BroadcastGroup">
                     <group-address>231.7.7.9</group-address>
                     <group-port>9876</group-port>
                     <broadcast-period>1000</broadcast-period>
                     <connector-ref connector-name="netty"/>
                  </broadcast-group>
               </broadcast-groups>
            
               <discovery-groups>
                  <discovery-group name="MY-DiscoveryGroup">
                     <group-address>231.7.7.9</group-address>
                     <group-port>9876</group-port>
                     <refresh-timeout>10000</refresh-timeout>
                  </discovery-group>
               </discovery-groups>
               
               <cluster-connections>
                  <cluster-connection name="MY-Cluster">
                     <address>jms</address>     
                    <retry-interval>500</retry-interval>
                    <use-duplicate-detection>true</use-duplicate-detection>
                    <forward-when-no-consumers>false</forward-when-no-consumers>
                    <max-hops>1</max-hops>    
                        <discovery-group-ref discovery-group-name="MY-DiscoveryGroup"/>
                  </cluster-connection>
               </cluster-connections>
               
               <security-settings>
                  <security-setting match="#">
                     <permission type="createNonDurableQueue" roles="guest"/>
                     <permission type="deleteNonDurableQueue" roles="guest"/>
                     <permission type="createDurableQueue" roles="guest"/>
                     <permission type="deleteDurableQueue" roles="guest"/>
                     <permission type="consume" roles="guest"/>
                     <permission type="send" roles="guest"/>
                  </security-setting>
               </security-settings>
            
               <address-settings>
                  <!--default for catch all-->
                  <address-setting match="#">
                     <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                     <expiry-address>jms.queue.ExpiryQueue</expiry-address>
                     <redelivery-delay>0</redelivery-delay>
                     <max-size-bytes>10485760</max-size-bytes>       
                     <message-counter-history-day-limit>10</message-counter-history-day-limit>
                     <address-full-policy>BLOCK</address-full-policy>
                  </address-setting>
               </address-settings>
               <cluster-user>HORNETQ.CLUSTER.ADMIN.USER</cluster-user>
               <cluster-password>mypassword</cluster-password>   
            </configuration>
            

             

            hornetq-jms.xml

             

            <configuration xmlns="urn:hornetq"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
                
                <connection-factory name="ConnectionFactory">
                    <discovery-group-ref discovery-group-name="MY-DiscoveryGroup"/>
                    <entries>
                    <entry name="ConnectionFactory"/>
                    </entries>
                </connection-factory>
            <queue name="myQueue">
                  <entry name="/queue/myQueue"/>
               </queue>
            </configuration>
            

             

            The timeout exception:

             

            javax.jms.JMSException: Timed out waiting to receive initial broadcast from discovery group

                    at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1112)

                    at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:849)

                    at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:565)

                    at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:624)

                    at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116)

                    at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:111)

                    at TestApp.<init>(TestApp.java:48)

                    at TestApp.main(TestApp.java:385)

            Caused by: HornetQException[errorCode=3 message=Timed out waiting to receive initial broadcast from discovery group]

                    ... 8 more

             

            I appreciate any kind of help with this matter,

             

            thanks in advance,

             

            Sami

            • 3. Re: HornetQ cluster connection using VPN
              Clebert Suconic Master

              You just need proper network configs, where UDP is sent through your connection.

               

              We have no specific requirements on your network config.

              • 4. Re: HornetQ cluster connection using VPN
                Clebert Suconic Master

                You probably have a configuration mismatch.

                 

                 

                I would use static cluster on your case.

                • 5. Re: HornetQ cluster connection using VPN
                  Sami GH Newbie

                  Thanks Clebert,

                   

                  I managed to connect to the cluster using static configurations.

                   

                  Best Regards,

                   

                  Sami