对server事件的监控主要是实现MemberListener类,对Cache事件的监控主要通过MapListener

参考代码

package coherencetest;

import com.tangosol.net.CacheFactory;
import com.tangosol.net.MemberEvent;
import com.tangosol.net.MemberListener;
import com.tangosol.net.NamedCache;
import com.tangosol.util.MapEvent;
import com.tangosol.util.MapListener;

class ProxyListenerNotification implements MemberListener {
public void memberJoined (MemberEvent e) {
System.out.println("====== Member Join ");
}
public void memberLeaving(MemberEvent e) {}
public void memberLeft(MemberEvent e) {
System.out.println("************ Member Left");

 System.out.println(e.getMember());
//NamedCache cache = CacheFactory.getCache("POFSample");
//cache.size(); // force reconnection to another proxy server
}
}

public class ProxyListener {

public static void main(String[] args) {
try {
NamedCache cache = CacheFactory.getCache("POFSample");
/*
cache.addMapListener(new MapListener() {

public void entryUpdated(MapEvent arg0) {
System.out.println(arg0);
}

public void entryInserted(MapEvent arg0) {
System.out.println(arg0);

}
public void entryDeleted(MapEvent arg0) {
System.out.println(arg0);
}});
*/
cache.getCacheService().addMemberListener(new ProxyListenerNotification());

while(true){
// Thread.sleep(100000);
}
} catch (Exception e) {
System.out.println(e);
}
}
}

当proxy server或storage server加入或者离开集群时,输出如下:

TcpRing{Connections=[3]}
IpMonitor{Addresses=0, Timeout=15s}

2016-09-14 14:42:16.393/5.929 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Invocation:Management, member=5): Service Management joined the cluster with senior service member 3
2016-09-14 14:42:17.118/6.653 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=DistributedCache, member=5): Service DistributedCache joined the cluster with senior service member 2
2016-09-14 14:42:25.120/14.654 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Cluster, member=5): Member(Id=6, Timestamp=2016-09-14 14:42:24.923, Address=10.182.168.155:27343, MachineId=48051, Location=site:cn.oracle.com,machine:ENIE-CN,process:12408, Role=CoherenceServer) joined Cluster with senior member 2
2016-09-14 14:42:26.835/16.369 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Transport:TransportService, member=5): Member 6 joined Service TransportService with senior member 2
2016-09-14 14:42:26.889/16.424 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Invocation:Management, member=5): Member 6 joined Service Management with senior member 3
====== Member Join
2016-09-14 14:42:28.721/18.255 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=DistributedCache, member=5): Member 6 joined Service DistributedCache with senior member 2
2016-09-14 14:42:40.397/29.931 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Cluster, member=5): Member(Id=7, Timestamp=2016-09-14 14:42:40.205, Address=10.182.168.155:27375, MachineId=48051, Location=site:cn.oracle.com,machine:ENIE-CN,process:13084, Role=CoherenceServer) joined Cluster with senior member 2
2016-09-14 14:42:42.529/32.063 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Transport:TransportService, member=5): Member 7 joined Service TransportService with senior member 2
2016-09-14 14:42:42.567/32.100 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Invocation:Management, member=5): Member 7 joined Service Management with senior member 3
2016-09-14 14:42:43.573/33.107 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=DistributedCache, member=5): Member 7 joined Service DistributedCache with senior member 2
====== Member Join
************ Member Left

====================
Member(Id=6, Timestamp=2016-09-24 10:15:30.063, Address=172.31.8.56:28369, MachineId=48051, Location=site:cn.oracle.com,machine:ENIE-CN,process:10552, Role=CoherenceServer)

2016-09-14 14:42:52.175/41.708 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Cluster, member=5): Member(Id=2, Timestamp=2016-09-14 14:42:52.175, Address=10.182.168.155:27227, MachineId=48051, Location=site:cn.oracle.com,machine:ENIE-CN,process:12316, Role=CoherenceServer) left Cluster with senior member 3
2016-09-14 14:42:52.177/41.710 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Invocation:Management, member=5): Member 2 left service Management with senior member 3
2016-09-14 14:42:52.180/41.713 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=DistributedCache, member=5): Member 2 left service DistributedCache with senior member 2
2016-09-14 14:42:52.367/41.899 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Transport:TransportService, member=5): Member 2 left service TransportService with senior member 2
2016-09-14 14:42:52.928/42.461 Oracle Coherence GE 12.2.1.0.0 <D5> (thread=Cluster, member=5): MemberLeft notification for Member(Id=2, Timestamp=2016-09-14 14:42:52.175, Address=10.182.168.155:27227, MachineId=48051, Location=site:cn.oracle.com,machine:ENIE-CN,process:12316, Role=CoherenceServer) received from Member(Id=3, Timestamp=2016-09-14 14:39:29.281, Address=10.182.168.155:27214, MachineId=48051, Location=site:cn.oracle.com,machine:ENIE-CN,process:11880, Role=CoherenceServer)

监控Coherence成员的加入和离开集群事件的更多相关文章

  1. Coherence代理节点在离开集群时的恢复

    Coherence的架构参考 在极端压力之下,有时候代理节点会忙于处理请求而不响应其他的心跳,同步,导致其他节点传输的报文没有回应,而被认为是离开集群,从而影响业务. 写了一段代码,能让进程在监听到有 ...

  2. 互联网级监控系统必备-时序数据库之Influxdb集群及踩过的坑

    上篇博文中,我们介绍了做互联网级监控系统的必备-Influxdb的关键特性.数据读写.应用场景: 互联网级监控系统必备-时序数据库之Influxdb 本文中,我们介绍Influxdb数据库集群的搭建, ...

  3. 【kubernetes 自带监控】 container级别cadvisor+kubelet,集群级别apiserver

    apiserver https://feisky.gitbooks.io/kubernetes/components/apiserver.html kube-apiserver 支持同时提供 http ...

  4. 第1节 storm日志告警:1、 - 5、日志监控告警业务需求、代码、集群运行、总结

    如何解决短信或者邮件频繁发送的问题:每次发送的时候都先查询数据库记录,看一下有没有给这个人发送消息,上一次发送消息的时间是什么时候,如果发送时间间隔小于半个小时,就不要再发了 ============ ...

  5. akka框架——异步非阻塞高并发处理框架

    akka actor, akka cluster akka是一系列框架,包括akka-actor, akka-remote, akka-cluster, akka-stream等,分别具有高并发处理模 ...

  6. Coherence的集群成员的离开和加入机制研究

    最近在客户那里环境中coherence集群不稳定,所以找出一些文档,需要搞清楚Coherence内部的一些机制 1.集群成员的离开 关于状态的检测,官方的说法是: Death detection is ...

  7. 分布式网格缓存Coherence简介

    Coherence企业级缓存(一) 特点 摘要:Oracle Coherence是一个企业级的分布式集群缓存框架.具有自管理,自恢复,高可用性,高扩展性等优良特点,在电信BOSS等项目中有很大的应用价 ...

  8. oracle coherence介绍及使用

    网上除了官方用户指南,关于Coherence的介绍文章资料很少,因此总结出此文,从原理到快速指南和基本最佳实践,希望对需要的人提供一个参考. 1 Coherence 概述 1.1 Coherence是 ...

  9. Cloud Insight 现在已经支持监控 Cassandra 啦!

    Cassandra 是什么? Apache Cassandra 以其可扩展性和容错分布式数据库系统而被人所熟知.Cassandra 起源于Facebook 最初创建于 Amazon Dynamo 和谷 ...

随机推荐

  1. 【洛谷 P1251】 餐巾计划问题 (费用流)

    题目链接 我做的网络流24题里的第一题.. 想是不可能想到的,只能看题解. 首先,我们拆点,将一天拆成晚上和早上,每天晚上会受到脏餐巾(来源:当天早上用完的餐巾,在这道题中可理解为从原点获得),每天早 ...

  2. UVALIVE 3562 Remember the A La Mode!

    费用流 建图很简单直接上代码 #include <map> #include <set> #include <list> #include <cmath> ...

  3. DECODE 与CASE WHEN 的比较以及用法

    1.DECODE 只有Oracle 才有,其它数据库不支持; 2.CASE WHEN的用法, Oracle.SQL Server. MySQL 都支持; 3.DECODE 只能用做相等判断,但是可以配 ...

  4. PoI导出列表优化

    针对写了头信息之后,使用for循环遍历会导致数据丢失问题的优化,使用迭代器替代for循环,具体如下: public static boolean ExportDeptLeaderFileToLocal ...

  5. [ Openstack ] OpenStack-Mitaka 高可用之 镜像服务(glance)

    目录 Openstack-Mitaka 高可用之 概述    Openstack-Mitaka 高可用之 环境初始化    Openstack-Mitaka 高可用之 Mariadb-Galera集群 ...

  6. c语言,warning: return type of 'main' is not `int'怎么解决?

    ////警告可以忽略,但如果严格点的话 #include<stdio.h> #include<math.h>   int main(int argc, char *arg[]) ...

  7. 开放API端口SIGN算法详细设计

    开放API端口SIGN算法详细设计 前言 在app开放接口api的设计中,避免不了的就是安全性问题,因为大多数接口涉及到用户的个人信息以及一些敏感的数据,所以对这些接口需要进行身份的认证,那么这就需要 ...

  8. 平滑部署war包到tomcat-deploy.sh

    #!/bin/sh #check war exists echo "check war exists" war_file_path=/data/tomcat8/webapps wa ...

  9. mysql TIMESTAMPDIFF

    在MySQL应用时,经常要使用这两个函数TIMESTAMPDIFF和TIMESTAMPADD. 一,TIMESTAMPDIFF 语法: TIMESTAMPDIFF(interval,datetime_ ...

  10. Jmeter 监控远程服务器

    压力测试中如何监控服务器的性能呢? 性能选取哪些指标? 环境配置: Jmeter安装路径:E:\SOFEWARE\apache-jmeter-3.1: 需要将JMeterPlugins-Extras. ...