RedisMonitor监视器

9 篇文章 0 订阅
4 篇文章 0 订阅

RedisMonitor监视器 。主要用于监视redis集群环境下的命令。

依赖于RedisUtils工具包。 https://blog.csdn.net/huangyueranbbc/article/details/84326844 

github地址:https://github.com/huangyueranbbc/RedisMonitor

 

The commands that are being executed in the redis of the cluster environment can be monitored.  

1. support log4j log output  
2. support custom output types  
3. support the monitoring of a specified machine, including master or salver  

java -jar CLASS <address[host:port,host:port......]>    
java -jar RedisMonitor.jar master:7001,slaver:7001 

可以对集群环境的redis中正在执行的命令进行监控。

1.支持log4j日志输出
2.支持自定义输出类型
3.支持对指定机器的监控,包括master或者salver

 

import com.hyr.redis.RedisClusterProxy;
import com.hyr.redis.RedisClusterUtils;

/*******************************************************************************
 * @date 2018-03-20 上午 11:14
 * @author: <a href=mailto:>黄跃然</a>
 * @Description: redis集群环境监控
 ******************************************************************************/
public class RedisMonitor {

    public static void main(String[] args) {
        if (args.length < 1) {
            System.out.println("java -jar CLASS <address[host:port,host:port......]>");
            return;
        }
        String address = args[0];
        RedisClusterProxy jedisCluster = RedisClusterUtils.getRedisClusterInstance(address);
        RedisClusterUtils.monitor(jedisCluster, 10000000);
    }

}

监视输出:

2018-03-20 15:35:55 [Thread-9] - node1:7000--1521531334.966951 [0 10.240.47.187:36306] "GET" "5_upload_redis_process_offset"   
2018-03-20 15:35:55 [Thread-4] - 10.240.47.188:7000--1521531334.966951 [0 10.240.47.187:36306] "GET" "5_upload_redis_process_offset"   
2018-03-20 15:35:55 [Thread-1] - node2:7000--1521531355.360183 [0 10.240.47.188:27798] "RPOP" "5_upload_mission_key"   
2018-03-20 15:35:55 [Thread-11] - 10.240.47.189:7000--1521531355.360183 [0 10.240.47.188:27798] "RPOP" "5_upload_mission_key"   
2018-03-20 15:35:57 [Thread-1] - node2:7000--1521531357.650564 [0 10.240.47.187:31106] "RPOP" "5_upload_mission_key"   
2018-03-20 15:35:57 [Thread-11] - 10.240.47.189:7000--1521531357.650564 [0 10.240.47.187:31106] "RPOP" "5_upload_mission_key"   
2018-03-20 15:36:00 [Thread-11] - 10.240.47.189:7000--1521531360.360646 [0 10.240.47.188:27798] "RPOP" "5_upload_mission_key"   
2018-03-20 15:36:00 [Thread-1] - node2:7000--1521531360.360646 [0 10.240.47.188:27798] "RPOP" "5_upload_mission_key"   
2018-03-20 15:36:02 [Thread-1] - node2:7000--1521531362.651219 [0 10.240.47.187:31106] "RPOP" "5_upload_mission_key"   
2018-03-20 15:36:02 [Thread-11] - 10.240.47.189:7000--1521531362.651219 [0 10.240.47.187:31106] "RPOP" "5_upload_mission_key"   
2018-03-20 15:36:05 [Thread-1] - node2:7000--1521531365.361205 [0 10.240.47.188:27798] "RPOP" "5_upload_mission_key"    
2018-03-20 15:36:05 [Thread-11] - 10.240.47.189:7000--1521531365.361205 [0 10.240.47.188:27798] "RPOP" "5_upload_mission_key"  

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值