Cassandra内建的工具nodetool - 监控篇
发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,Cassandra 常用监控命令Cassandra 自带了多个功能强大集群或数据管理工具,数量掌握有助于诊断和维护Cassandra集群、快速解决各种问题:nodetoolnodetool是一个命令行
千家信息网最后更新 2025年12月02日Cassandra内建的工具nodetool - 监控篇
Cassandra 常用监控命令
Cassandra 自带了多个功能强大集群或数据管理工具,数量掌握有助于诊断和维护Cassandra集群、快速解决各种问题:
nodetool
nodetool是一个命令行的工具集,它可以监控Cassandra和执行例行的数据库操作。作为内建的工具,nodetool一般用于在节点上直接运行。
nodetool工具集支持大多数重要的JMX指标和操作,并且包含了一些为管理员准备的命令。
相关命令如下:
nodetool: 是一个命令行的工具集,它可以监控Cassandra和执行例行的数据库操作。作为内建的工具,nodetool一般用于在节点上直接运行。nodetool工具集支持大多数重要的JMX指标和操作,并且包含了一些为管理员准备的命令。cassandra utility: Cassandra utility 其实是Cassandra提供的一个启动时配置接口,也就是说通过这个方法可以配置cassandra启动参数,例如运行时java heap size等。cassandra-stress tool:cassandra stress tool是一个针对集群进行压力测试的工具.SSTable utilities: 是一组操作sstable的工具CQL shell:是一个通过CQL( Cassandra Query Language)来与Cassandra集群中的数据进行交互的命令行工具,集群节点列表:
[cassandra]172.20.101.157 172.20.101.164 172.20.101.165 172.20.101.160 172.20.101.166 172.20.101.167 列出nodetool所有可用的命令
nodetool help 列出指定command 的帮助内容
nodetool help command-name例如:查看status 命令的详细帮助内容
nodetool help statusnodetool常用监控命令:
nodetool工具集提供了一批用于查看表的指标、服务器指标和压缩统计。
nodetool describecluster
输出集群信息
Cluster Information: Name: pttest Snitch: org.apache.cassandra.locator.GossipingPropertyFileSnitch DynamicEndPointSnitch: enabled Partitioner: org.apache.cassandra.dht.Murmur3Partitioner Schema versions: 8560f200-adbb-3a18-8d5e-a1f7f7856194: [172.20.101.164, 172.20.101.165, 172.20.101.166, 172.20.101.167, 172.20.101.160, 172.20.101.157]nodetool status:
输出集群环的快速摘要和集群的当前状况;
[root@kubm-01 ~]# nodetool status Datacenter: dc1===============Status=Up/Down|/ State=Normal/Leaving/Joining/Moving-- Address Load Tokens Owns (effective) Host ID RackUN 172.20.101.164 173.72 KiB 256 34.2% dcbbad83-fe7c-4580-ade7-aa763b8d2c40 rack1UN 172.20.101.165 50.4 KiB 256 35.0% cefe8a3b-918f-463b-8c7d-faab0b9351f9 rack1UN 172.20.101.166 95.5 KiB 256 34.1% 88e16e35-50dd-4ee3-aa1a-f10a8c61a3eb rack1UN 172.20.101.167 50.4 KiB 256 32.3% 8808aaf7-690c-4f0c-be9b-ce655c1464d4 rack1UN 172.20.101.160 194.83 KiB 256 31.5% 57cc39fc-e47b-4c96-b9b0-b004f2b79242 rack1UN 172.20.101.157 176.67 KiB 256 33.0% 091ff0dc-415b-48a7-b4ce-e70c84bbfafc rack1nodetool netstats:
显示网络连接操作的统计数据;
[root@kubm-01 ~]# nodetool netstats --human-readableMode: NORMALNot sending any streams.Read Repair Statistics:Attempted: 0Mismatch (Blocking): 0Mismatch (Background): 0Pool Name Active Pending Completed DroppedLarge messages n/a 0 0 0Small messages n/a 0 163 0Gossip messages n/a 0 3150335 0查看某个节点负载,内存使用情况
[ptmind@kubm-01 ~]$ nodetool info ID : 091ff0dc-415b-48a7-b4ce-e70c84bbfafcGossip active : trueThrift active : falseNative Transport active: trueLoad : 282.65 KiBGeneration No : 1561803589Uptime (seconds) : 844997Heap Memory (MB) : 354.14 / 3970.00Off Heap Memory (MB) : 0.00Data Center : dc1Rack : rack1Exceptions : 0Key Cache : entries 119, size 11.7 KiB, capacity 100 MiB, 435 hits, 596 requests, 0.730 recent hit rate, 14400 save period in secondsRow Cache : entries 0, size 0 bytes, capacity 0 bytes, 0 hits, 0 requests, NaN recent hit rate, 0 save period in secondsCounter Cache : entries 0, size 0 bytes, capacity 50 MiB, 0 hits, 0 requests, NaN recent hit rate, 7200 save period in secondsChunk Cache : entries 11, size 704 KiB, capacity 480 MiB, 1388 misses, 2253 requests, 0.384 recent hit rate, NaN microseconds miss latencyPercent Repaired : 100.0%Token : (invoke with -T/--tokens to see all 256 tokens)wnodetool tpstats:
显示如active、pending以及完成的任务等Cassandra操作的每个阶段的状态;
OPTIONS -F , --format Output format (json, yaml) [root@kubm-01 ~]# nodetool tpstats Pool Name Active Pending Completed Blocked All time blockedReadStage 0 0 140 0 0MiscStage 0 0 0 0 0CompactionExecutor 0 0 491131 0 0MutationStage 0 0 45 0 0MemtableReclaimMemory 0 0 586 0 0PendingRangeCalculator 0 0 13 0 0GossipStage 0 0 3150790 0 0.....PerDiskMemtableFlushWriter_0 0 0 586 0 0ValidationExecutor 0 0 0 0 0.....Message type DroppedREAD 0.........REQUEST_RESPONSE 0PAGED_RANGE 0READ_REPAIR 0nodetool cfstats:
显示了每个表和keyspace的统计数据;
选项 -F , --format Output format (json, yaml) -H, --human-readable Display bytes in human readable form, i.e. KiB, MiB, GiB, TiB -i Ignore the list of tables and display the remaining tables 创建keyspacecreate keyspace ptmind_test with replication = {'class':'NetworkTopologyStrategy','dc1':2} and durable_writes = true;创建表cassandra@cqlsh:ptmind_test> CREATE TABLE users ( ... user_id text PRIMARY KEY, ... first_name text, ... last_name text, ... emails set ... );插入数据:INSERT INTO users (user_id, first_name, last_name, emails) VALUES('2', 'kevin', 'kevin', {'kevin@ptmind.com', 'kevin@gmail.com'}); 查看指定表空间,默认输出所有
[root@kubm-01 ~]# nodetool cfstats ptmind_test.usersTotal number of tables: 37----------------Keyspace : ptmind_test Read Count: 0 Read Latency: NaN ms Write Count: 0 Write Latency: NaN ms Pending Flushes: 0 Table: users................................ Average live cells per slice (last five minutes): NaN Maximum live cells per slice (last five minutes): 0 Average tombstones per slice (last five minutes): NaN Maximum tombstones per slice (last five minutes): 0 Dropped Mutations: 0nodetool cfhistograms:
显示表的统计数据,包括读写延迟,行大小,列的数量和SSTable的数量;
[root@kubm-01 ~]# nodetool cfhistograms ptmind_test.usersNo SSTables exists, unable to calculate 'Partition Size' and 'Cell Count' percentilesptmind_test/users histogramsPercentile SSTables Write Latency Read Latency Partition Size Cell Count (micros) (micros) (bytes) 50% 0.00 0.00 0.00 NaN NaN........Max 0.00 0.00 0.00 NaN NaNnodetool compactionstats
显示当前正在压缩的任务进度
pending tasks: 0
工具
命令
数据
集群
工具集
监控
指标
节点
统计
数量
统计数据
管理
输出
运行
重要
任务
内容
常用
数据库
管理员
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
轻量化服务器cpu满了
直播软件开发流程视频
芯片检测网络安全
技校网络技术跟大数据哪个好
玄中记服务器注册已满
互联网教育科技统计
服务器角色属于权限管理
soul软件开发多少钱
星网视易软件开发
计算计网络技术是什么
软件开发公司可以合伙吗
公司网络安全管理方针全员参与
杭州蒲石网络技术
dellr830服务器配置
新服务器急需管理员
修谱软件开发
云求数据库系统
删除数据库 判刑
植物病理学报 数据库
网络安全一体价格
数据库加密技术的新发现
达梦数据库备份导出
代理服务器设置 手机
网络安全专业技术人员考试试题
社旗法院开展网络安全宣传
联想服务器rd350
服务器电源 拆
服务器系统盘启动盘制作
南京邦克软件开发服务中心
数据库压力测试视频