lsp66

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

监控数据写入:通过 Linux 定时任务(crontab)调用脚本,采集 HBase 监控数据(hbase status/JMX),写入 MySQL:

crontab -e 配置每分钟采集一次

*/1 * * * * /usr/local/scripts/hbase_monitor.sh >> /var/log/hbase_monitor.log 2>&1
脚本示例(hbase_monitor.sh):

!/bin/bash

采集HBase RegionServer数量

RS_COUNT=$(hbase shell -n "status" | grep "RegionServers" | awk '{print $2}')

写入MySQL

mysql -h mysql-ip -u root -pMysql@123 -e "INSERT INTO hbase_monitor (rs_count, collect_time) VALUES ($RS_COUNT, NOW());"
MySQL 表设计:针对 HBase 监控数据设计宽表,字段包含指标名、指标值、采集时间、集群节点等。

posted on 2026-01-03 14:02  李世鹏66  阅读(0)  评论(0)    收藏  举报