Hi Keiichi Fujino,

thank you very much for pointing me to the TcpPingInterceptor. Now the
members on the other machines get informed of the shutdown:
        tcpPingInterceptor.setNext(tcpFailureDetector);
        tcpFailureDetector.setPrevious(tcpPingInterceptor);
        tcpFailureDetector.setNext(staticMembershipInterceptor);
        staticMembershipInterceptor.setPrevious(tcpFailureDetector);
        staticMembershipInterceptor.setNext(messageDispatchInterceptor);
        messageDispatchInterceptor.setPrevious(staticMembershipInterceptor);
      ...
      _clusterChannel.addInterceptor(tcpPingInterceptor);
      _clusterChannel.addInterceptor(tcpFailureDetector);
      _clusterChannel.addInterceptor(staticMembershipInterceptor);
      _clusterChannel.addInterceptor(messageDispatchInterceptor);

THANK YOU!

(my custom classes are just extending the base-classes)


Kind regards
Dave


p.s.
i am top posting, as the answer of my first post was posted top too :-)


Am 26.03.2014 10:13, schrieb Keiichi Fujino:
> The above code because it is used by the custom class of your own,
> I am not able to reproduce this, but at least, as far as I see this code,
> TcpPingInterceptor do not seem to use.
>
> If using both TcpFailureDetector and StaticMembershipInterceptor,
> TcpFailureDetector manages the membership of the static member.
> However, in this case, the addition of the static members to membership can
> be detected automatically by the heartbeat of TcpFailureDetector, but does
> not detect the shutdown of the static member automatically.
> (It is only possible to be detect members that fails to send message at
> TcpFailureDetector.sendMessage.)
>
> When using the StaticMembershipInterceptor(and TcpFailureDetector),
> in order to detect the shutdown of the static member automatically by
> heartbeat,
> you must use the TcpPingInterceptor.
> TcpPingInterceptor monitors cluster members by the TCP check.
>
> ex.
> TcpPingInterceptor -> TcpFailureDetector ->  StaticMembershipInterceptor
>
>
>
> 2014-03-25 2:11 GMT+09:00 D.R. <d.re...@googlemail.com>:
>
>> Hi,
>>
>> we are using tomcat 6.0.39 on linux machines.
>> I've implemented a clustering via tribes for exchanging messages with
>> static membership. We are not using mutlicast as it does not work with
>> linux vserver. We are not using session replication. We just want to
>> exchange some commands.
>> Everything works fine, except that the cluster is not informed if a
>> member from a different machine is shut down.
>>
>> For example:
>> I have member1 and member2 on one machine with ip 192.168.0.88 and
>> member3 and member4 on an other machine with ip 192.168.0.89
>> If i shutdown member4, member3 calls the memberDisappeared() method of
>> my membershiplistener.
>> But this method is not called by the members member1 and member2.
>> member1 and member2 are still referencing the dead member4, if i call
>> channel.getmembers()
>>
>> This is my code for setting up the cluster:
>>
>> final StandardEngine engine = (StandardEngine)
>> ServerFactory.getServer().findService(CATALINA_SERVICE).getContainer();
>>
>> final Container hostContainer = getHostContainer(engine);
>>
>> _simpleTcpCluster = new SimpleTcpCluster();
>> _simpleTcpCluster.setProperty("channelStartOptions", 3);    //disable
>> multicast
>> _simpleTcpCluster.setProperty("channelSendOptions", 8);    // ???
>>
>> final TcpFailureDetector tcpFailureDetector = new TcpFailureDetector();
>>
>> final MyMessageDispatch15Interceptor messageDispatchInterceptor = new
>> MyMessageDispatch15Interceptor();
>> final MyChannelReceiver myChannelReceiver = new
>> MyChannelReceiver(mysc.getClusterListenAddress());
>> myChannelReceiver.setPort(_clusterPort);
>>
>> final StaticMembershipInterceptor staticMembershipInterceptor = new
>> StaticMembershipInterceptor();
>> final  Tuple2<Integer,List<StaticMember>> members = getMembers();
>> for(final Member member : members.getB()){
>>     if (member.isReady()) {
>>         LOGGER.info("[" + mysc.getStoreGroupId() + "-app] adding static
>> member: " + MyMembershipListener.getMemberId(member));
>>         staticMembershipInterceptor.addStaticMember(member);
>>     } else {
>>         LOGGER.info("[" + mysc.getStoreGroupId() + "-app] static member
>> not ready: " + MyMembershipListener.getMemberId(member) + ", not
>> added");  //this is never called
>>     }
>> }
>> tcpFailureDetector.setNext(staticMembershipInterceptor);
>> staticMembershipInterceptor.setPrevious(tcpFailureDetector);
>> staticMembershipInterceptor.setNext(messageDispatchInterceptor);
>> messageDispatchInterceptor.setPrevious(staticMembershipInterceptor);
>> _myMembershipService = new MyMembershipService(members.getA());
>> //
>> myMembershipService.setMcastBindAddress(mysc.getClusterListenAddress());
>> //forces an error
>>
>> _clusterChannel = new MyGroupChannel();
>> _clusterChannel.setMembershipService(_myMembershipService);
>> _clusterChannel.setChannelReceiver(myChannelReceiver);
>> _clusterChannel.addInterceptor(tcpFailureDetector);
>> _clusterChannel.addInterceptor(staticMembershipInterceptor);
>> _clusterChannel.addInterceptor(messageDispatchInterceptor);
>> _clusterChannel.addMembershipListener(_mbrListener);
>> _clusterChannel.addChannelListener(_msgListener);
>>
>> _simpleTcpCluster.setChannel(_clusterChannel);
>> hostContainer.setCluster(_simpleTcpCluster);
>>
>> try {
>>     _clusterChannel.start(Channel.DEFAULT);
>> } catch (ChannelException e) {
>>     e.printStackTrace();
>> }
>>
>> final Member[] group = _clusterChannel.getMembers();
>> if(group.length < 1){
>>     LOGGER.info("[" + mysc.getStoreGroupId() + "-app] did not find any
>> other cluster-members");
>> } else {
>>     LOGGER.info("[" + mysc.getStoreGroupId() + "-app] found the
>> following cluster-members:");
>>     for(final Member m : group){
>>         LOGGER.info("[" + mysc.getStoreGroupId() + "-app] name: " +
>> m.getName() + ", port: " + m.getPort() + ", uniqueid: " +
>> MyMembershipListener.getMemberId(m));
>>     }
>> }
>>
>> Any help is welcome.
>>
>>
>> With kind regards
>> Dave
>>
>> --
>> Keiichi.Fujino

Reply via email to