2 Replies Latest reply on Aug 14, 2012 10:18 PM by luozhuang

    How to make 2 node communiate using TCP cluster config

    hari1234

      Hi,

       

      I have got 2 servers in cluster by using cluster config of Jbosscaching. I am using TreeCacheMBean and filling the cache through a quartz schedular. I stopped the schedular on one of the node and wanted to test whether the cache from other server would replicated to this one. but I get following error message in second server log while trying to restart the first server. My intension for doing this was, I was doing the put() methods to fill the cache through schedular which as being called at the first server start up. I was expecting that this would me the replicater called and the cache would get replicated on to second server.

       

      [2010-07-24 06:56:58,101 ERROR [STDERR]  at org.jgroups.protocols.TP$IncomingMessageHandler.run(TP.java:1343)
      2010-07-24 06:56:58,101 ERROR [STDERR]  at java.lang.Thread.run(Thread.java:619)
      2010-07-24 06:56:58,101 INFO  [org.jboss.cache.marshall.VersionAwareMarshaller] Caught exception unmarshalling stream with specific versioned marshaller class org.jboss.cache.marshall.TreeCacheMarshaller140.  Attempting to try again with legacy marshaller class org.jboss.cache.marshall.LegacyTreeCacheMarshaller
      2010-07-24 06:56:58,101 DEBUG [org.jboss.cache.marshall.VersionAwareMarshaller] Retry with legacy marshaller failed as well; throwing original exception
      java.io.StreamCorruptedException: invalid stream header: 6A627331
              at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
              at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
              at org.jboss.invocation.MarshalledValueInputStream.<init>(MarshalledValueInputStream.java:74)
              at org.jboss.cache.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:186)
              at org.jgroups.blocks.RpcDispatcher.handle(RpcDispatcher.java:254)
              at org.jgroups.blocks.RequestCorrelator.handleRequest(RequestCorrelator.java:654)
              at org.jgroups.blocks.RequestCorrelator.receiveMessage(RequestCorrelator.java:544)
              at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:367)
              at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:779)
              at org.jgroups.JChannel.up(JChannel.java:1090)
              at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:382)
              at org.jgroups.stack.ProtocolStack.receiveUpEvent(ProtocolStack.java:398)
              at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
              at org.jgroups.protocols.pbcast.STATE_TRANSFER.up(STATE_TRANSFER.java:158)
              at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
              at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
              at org.jgroups.protocols.pbcast.GMS.up(GMS.java:763)
              at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
              at org.jgroups.protocols.pbcast.GMS.receiveUpEvent(GMS.java:783)
              at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
              at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:262)
              at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
              at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
              at org.jgroups.protocols.pbcast.NAKACK.handleMessage(NAKACK.java:685)
              at org.jgroups.protocols.pbcast.NAKACK.up(NAKACK.java:517)
              at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
              at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
              at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPECT.java:170)
              at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
              at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
              at org.jgroups.protocols.FD.up(FD.java:300)
              at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
              at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
              at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:305)
              at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
      Type  :quit<Enter>  to exit Vim                                                                            11384,2-9     99%

        • 1. Re: How to make 2 node communiate using TCP cluster config
          saradakrishna

          Hi,

          Please try the following steps, i hope this will help you out:-

           

           

          1. For each successive node in your cluster, navigate to the directory <JBOSS_HOME>/ server/all/deploy, then open the following files:

            cluster-service.xml

            tc5-cluster-service.xml

            1. Comment out the following block in both of the preceding files:

              <!--
              <Config>
                          <UDP mcast_addr="228.1.2.3" mcast_port="45566" ip_ttl="8" ip_mcast="true" mcast_send_buf_size="800000" mcast_recv_buf_size="150000" ucast_send_buf_size="800000" ucast_recv_buf_size="150000" loopback="false"/>
                          <PING timeout="2000" num_initial_members="3" up_thread="true" down_thread="true"/>
                          <MERGE2 min_interval="10000" max_interval="20000"/>            <FD shun="true" up_thread="true" down_thread="true" timeout="2500" max_tries="5"/>
                          <VERIFY_SUSPECT timeout="3000" num_msgs="3" up_thread="true" down_thread="true"/>
                          <pbcast.NAKACK gc_lag="50" retransmit_timeout="300,600,1200,2400,4800" max_xmit_size="8192" up_thread="true" down_thread="true"/>
                          <UNICAST timeout="300,600,1200,2400,4800"                window_size="100" min_threshold="10" down_thread="true"/>
                          <pbcast.STABLE desired_avg_gossip="20000"
                             up_thread="true" down_thread="true"/>
                          <FRAG frag_size="8192" down_thread="true" up_thread="true"/>            <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"               shun="true" print_local_addr="true"/>            <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
                       </Config>
              -->

            2. Uncomment the following block in both files:

               <Config>
                          <TCP bind_addr="thishost" start_port="7800" loopback="true"/>            <TCPPING initial_hosts="thishost[7800],otherhost[7800]" port_range="3" timeout="3500" num_initial_members="3" up_thread="true"               down_thread="true"/>
                          <MERGE2 min_interval="5000" max_interval="10000"/>
                          <FD shun="true" timeout="2500" max_tries="5" up_thread="true"              down_thread="true" />
                          <VERIFY_SUSPECT timeout="1500" down_thread="false" up_thread="false" />
                          <pbcast.NAKACK down_thread="true" up_thread="true"               gc_lag="100" retransmit_timeout="3000"/>
                          <pbcast.STABLE desired_avg_gossip="20000" down_thread="false"              up_thread="false" />
                          <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"              shun="false"  print_local_addr="true" down_thread="true"              up_thread="true"/>
                          <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>         </Config>

            3. Within the block listed in Step b, replace thishost with the IP of the machine on which you are currently working. The entire IP list must be surrounded by double quotes. For example: TCPbind_addr="192.168.161.20".

            4. Within the block listed in Step b, replace otherhost with the IP of the other machine in the cluster, or, if the cluster contains more than two nodes, replace otherhost with a comma-delimited list of all the IPs. The IP must be surrounded by double quotes.

          • 2. Re: How to make 2 node communiate using TCP cluster config
            luozhuang

            Hi,

            Follow  your advice, I have created a cluster consists of 2 server nodes. Now I want to access to the cluster from the third node, the third node play a role as a client, how to write the configuration file of client node? Is it the same as the configuation file in server node? But the configuration files in 2 server nodes are not the same.