博客
关于我
Cassandra监控运维工具
阅读量:798 次
发布时间:2023-04-02

本文共 3475 字,大约阅读时间需要 11 分钟。

Cassandra是一个去中心化的分布式数据库,每个节点都是对等的。在监控和维护Cassandra集群时,获取集群状态及相关指标是关键操作。以下从命令行和页面系统两方面介绍相关方法。

命令行

Cassandra提供了一系列nodetool命令,适用于各节点执行的操作。以下是nodetool命令的列表及其说明:

  • assassinate:强制移除某个节点,数据不会迁移到新环。
  • bootstrap:触发节点清理操作,移除不属于当前节点的数据。
  • clearsnapshot:清除本机的snapshot,若无keyspace信息则清理全部snapshot。
  • compact:触发major compaction。
  • compactionhistory:打印compaction历史信息。
  • compactionstats:显示compaction状态。
  • decommission:将节点从环中移除。
  • describecluster:打印集群信息,包括clustername、snitch信息、partitionr信息及schema。
  • disableautocompaction:关闭minor compaction。
  • disablebackup:关闭自动增量备份。
  • disablebinary:关闭9042端口服务。
  • disablegossip:关闭gossip。
  • disablehandoff:关闭hinthandoff。
  • disablehintsfordc:关闭某dc的hint。
  • disablethrift:关闭9160端口服务。
  • drain:暂停节点操作,flush表并关闭minor compaction。
  • enableautocompaction:开启minor compaction。
  • enablebackup:开启自动增量备份。
  • enablebinary:开启9042端口服务。
  • enablegossip:开启gossip。
  • enablehandoff:开启hinthandoff。
  • enablehintsfordc:开启dc的hint handoff。
  • enablethrift:开启9160端口服务。
  • failedetector:显示集群失败探测信息。
  • flush:强制执行flush操作。
  • garbagecollect:清除删除数据的sstable。
  • gcstats:显示gc信息。
  • getcompactionthreshold:获取compaction阈值。
  • getcompactionthroughput:获取compaction吞吐量。
  • getconcurrentcompactors:获取并发compact数目。
  • getendpoints:获取拥有partition key的节点。
  • getinterdcstreamthroughput:获取dc stream吞吐量。
  • getlogginglevels:显示log等级。
  • getsstables:打印sstable信息。
  • getstreamthroughput:获取stream吞吐量。
  • gettimeout:获取超时值。
  • gettraceprobability:获取trace概率。
  • gossipinfo:显示gossip信息。
  • helpinfo:显示集群信息。
  • invalidatecountercache:使counter cache无效。
  • invalidatekeycache:使keycache无效。
  • invalidaterowcache:使rowcache无效。
  • join:加入环。
  • listsnapshots:列出snapshot。
  • move:移动节点到其他token位置,数据随迁移。
  • netstats:显示网络信息。
  • pausehandoff:暂停hinthandoff传递。
  • proxyhistograms:显示网络直方图。
  • rangekeysample:获取所有keyspace的key样本。
  • rebuild:从其他节点获取数据。
  • rebuild_index:重建本地二级索引。
  • refresh:重新加载本地sstable。
  • refreshsizeestimates:重建system.size_estimates表。
  • reloadlocalschema:重新加载本地schema。
  • reloadtriggers:重新加载trigger。
  • relocatesstables:将sstables迁移。
  • remove:移除节点,需force完成阻塞操作。
  • repair:修复副本间数据。
  • replaybatchlog:开始batch log replay。
  • resetlocalschema:重置本地schema。
  • resumehandoff:恢复hinthandoff传递。
  • ring:显示集群环信息。
  • scrub:清理节点无效数据。
  • setcachecapacity:设置cache容量。
  • setcachekeystosave:设置key保存cache容量。
  • setcompactionthreshold:设置compaction阈值。
  • setcompactionthroughput:设置compaction吞吐量。
  • setconcurrentcompactors:设置并发compaction数目。
  • sethintedhandoffthrottlekb:设置hint阈值。
  • setinterdcstreamthroughput:设置dc stream吞吐量。
  • setlogginglevel:设置log等级。
  • setstreamthroughput:设置stream阈值。
  • settimeout:设置超时值。
  • settraceprobability:设置trace概率。
  • snapshot:创建快照。
  • status:显示集群状态。
  • statusbackup:显示备份状态。
  • statusbinary:显示binary transport状态。
  • statusgossip:显示gossip状态。
  • statushandoff:显示hinthandoff状态。
  • statusthrift:显示thrift状态。
  • stop:停止compaction。
  • stopdaemon:停止cassandra deamon。
  • tablehistograms:显示表直方图。
  • tablestats:显示表状态。
  • toppartitions:显示活跃partition样本。
  • tpstats:显示thread pool状态。
  • truncatehints:删除节点所有hint。
  • upgradesstables:读取表数据并写入新sstables。
  • verify:验证表数据完整性。
  • version:显示cassandra版本。
  • viewbuildstatus:显示viewbuild状态。

执行这些命令时,需指定节点和端口,例如:./nodetool -h hosta -p 7199 command

页面系统

除了命令行操作,还可以通过页面系统进行监控和维护。以下是常用方法:

1. MX4J

MX4J是Cassandra提供的监控工具,需下载对应的jar包并放入Cassandra的lib目录。修改cassandra-env.sh,设置MX4J_ADDRESS地址,访问8081端口即可查看信息。需要注意本地IP可达性及仅能查看单个节点信息。

2. Jolokia + Telegraf

下载jolokia agent jar包,放入Cassandra lib目录。修改cassandra-env.sh,添加JVM_OPTS参数。重启集群后可通过本地Jolokia访问数据。结合Telegraf部署,收集相关指标。

3. Grafana + Prometheus + JMX Exporter

在每个Cassandra节点部署jmx_exporter jar包,并配置JMX Exporter。参考相应文档配置yml文件,收集metric。部署Prometheus和Grafana,使用Grafana的Cassandra指标模板(需修正JSON格式)。

4. OpsCenter

参考DataStax文档配置OpsCenter,提供集群监控和管理功能,支持多数据中心和跨集群操作。

通过以上方法,可以有效监控和维护Cassandra集群,获取集群状态、指标及执行必要操作。

转载地址:http://blefk.baihongyu.com/

你可能感兴趣的文章
org/eclipse/jetty/server/Connector : Unsupported major.minor version 52.0
查看>>
org/hibernate/validator/internal/engine
查看>>
Orleans框架------基于Actor模型生成分布式Id
查看>>
SQL-36 创建一个actor_name表,将actor表中的所有first_name以及last_name导入改表。
查看>>
ORM sqlachemy学习
查看>>
Ormlite数据库
查看>>
orm总结
查看>>
os.environ 没有设置环境变量
查看>>
os.path.join、dirname、splitext、split、makedirs、getcwd、listdir、sep等的用法
查看>>
os.removexattr 的 Python 文档——‘*‘(星号)参数是什么意思?
查看>>
os.system 在 Python 中不起作用
查看>>
OS2ATC2017:阿里研究员林昊畅谈操作系统创新与挑战
查看>>
OSCACHE介绍
查看>>
SQL--合计函数(Aggregate functions):avg,count,first,last,max,min,sum
查看>>
OSChina 周五乱弹 ——吹牛扯淡的耽误你们学习进步了
查看>>
SQL--mysql索引
查看>>
OSChina 周四乱弹 ——程序员为啥要买苹果手机啊?
查看>>
OSChina 周日乱弹 —— 2014 年各种奇葩评论集合
查看>>
OSChina 技术周刊第十期,每周技术抢先看!
查看>>
OSError: no library called “cairo-2“ was foundno library called “cairo“ was foundno library called
查看>>