ehcache监控

引入Maven依赖

<dependency>
  <groupId>org.terracotta.ehcachedx.com.javabi</groupId>
  <artifactId>javabi-sizeof</artifactId>   <version>0.3</version> </dependency> <dependency>   <groupId>org.terracotta.ehcachedx.monitor</groupId>   <artifactId>common</artifactId>   <version>1.0.2</version> </dependency> <dependency>   <groupId>commons-math</groupId>   <artifactId>commons-math</artifactId>   <version>1.2</version> </dependency>

将附件的代码拷贝到src/main/java目录下

将monitor.properties拷贝到src/main/resource目录下

创建ehcache.xml文件,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
         xsi:noNamespaceSchemaLocation="ehcache.xsd"  
         updateCheck="false" monitoring="autodetect"  
         dynamicConfig="true"> 
    
    <cacheManagerPeerListenerFactory
        class="org.terracotta.ehcachedx.monitor.probe.ProbePeerListenerFactory"
        properties="monitorAddress=监控服务器IP, monitorPort=监控服务器监听端口" />
    
    <cache name="sampleCache"
            maxEntriesLocalHeap="99999999"
            eternal="false"
            timeToIdleSeconds="1800"
            timeToLiveSeconds="1800"
            overflowToDisk="false"
            memoryStoreEvictionPolicy="LRU">
    </cache>

其中,【监控服务器IP】需要更换成真是IP,【监控服务器监听端口】需要更换成真实port

 

你可能感兴趣的:(ehcache监控)