Cassandra内建的工具nodetool - 监控篇
发表于:2025-02-02 作者:千家信息网编辑
千家信息网最后更新 2025年02月02日,Cassandra 常用监控命令Cassandra 自带了多个功能强大集群或数据管理工具,数量掌握有助于诊断和维护Cassandra集群、快速解决各种问题:nodetoolnodetool是一个命令行
千家信息网最后更新 2025年02月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 status
nodetool常用监控命令:
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 rack1
nodetool 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)w
nodetool 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 0
nodetool 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: 0
nodetool 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 NaN
nodetool compactionstats
显示当前正在压缩的任务进度
pending tasks: 0
工具
命令
数据
集群
工具集
监控
指标
节点
统计
数量
统计数据
管理
输出
运行
重要
任务
内容
常用
数据库
管理员
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
u8服务器管理工具下载
网络安全与个人隐私教育
php 数据库脚本
对网络安全性有什么看法
国开网络安全管理
电脑服务器共享上网
口碑好的软件开发联系人
等保网络安全吗
服务器 架设私服
刺激战场平台服务器无法登录
学软件开发大专
绝地求生测试服服务器加载失败
网易版手机服务器好玩的指令
工信行业网络安全宣传
数据库curd
mpp焊接数据库
中国电信网络安全专业就业方向
徐州专业软件开发售后保障
平板电脑的时间服务器哪里设置
cs客户端 数据库
江西的手机dns服务器云主机
软件开发公司有哪些优惠
什么是服务器名称
数据库怎么限制一个数字的上下限
最新数据库应用技术
湖南省软件开发工程师学费
西安去哪学软件开发
重庆古享互联网科技
网络技术需要什么软件
druid 时序数据库