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:

输出集群环的快速摘要和集群的当前状况;

[[email protected] ~]# nodetool status
Datacenter: dc1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address         Load       Tokens Owns (effective)  Host ID                               Rack
UN  172.20.101.164  173.72 KiB  256    34.2%       dcbbad83-fe7c-4580-ade7-aa763b8d2c40  rack1
UN  172.20.101.165  50.4 KiB   256    35.0%       cefe8a3b-918f-463b-8c7d-faab0b9351f9  rack1
UN  172.20.101.166  95.5 KiB   256    34.1%       88e16e35-50dd-4ee3-aa1a-f10a8c61a3eb  rack1
UN  172.20.101.167  50.4 KiB   256    32.3%       8808aaf7-690c-4f0c-be9b-ce655c1464d4  rack1
UN  172.20.101.160  194.83 KiB  256    31.5%       57cc39fc-e47b-4c96-b9b0-b004f2b79242  rack1
UN  172.20.101.157  176.67 KiB  256    33.0%       091ff0dc-415b-48a7-b4ce-e70c84bbfafc  rack1

nodetool netstats:

显示网络连接操作的统计数据;

[[email protected] ~]# nodetool netstats --human-readable
Mode: NORMAL
Not sending any streams.
Read Repair Statistics:
Attempted: 0
Mismatch (Blocking): 0
Mismatch (Background): 0
Pool Name                    Active   Pending      Completed   Dropped
Large messages                  n/a         0              0         0
Small messages                  n/a         0            163         0
Gossip messages                 n/a         0        3150335         0

查看某个节点负载,内存使用情况

[[email protected] ~]$ nodetool info
ID                     : 091ff0dc-415b-48a7-b4ce-e70c84bbfafc
Gossip active          : true
Thrift active          : false
Native Transport active: true
Load                   : 282.65 KiB
Generation No          : 1561803589
Uptime (seconds)       : 844997
Heap Memory (MB)       : 354.14 / 3970.00
Off Heap Memory (MB)   : 0.00
Data Center            : dc1
Rack                   : rack1
Exceptions             : 0
Key Cache              : entries 119, size 11.7 KiB, capacity 100 MiB, 435 hits, 596 requests, 0.730 recent hit rate, 14400 save period in seconds
Row Cache              : entries 0, size 0 bytes, capacity 0 bytes, 0 hits, 0 requests, NaN recent hit rate, 0 save period in seconds
Counter Cache          : entries 0, size 0 bytes, capacity 50 MiB, 0 hits, 0 requests, NaN recent hit rate, 7200 save period in seconds
Chunk Cache            : entries 11, size 704 KiB, capacity 480 MiB, 1388 misses, 2253 requests, 0.384 recent hit rate, NaN microseconds miss latency
Percent Repaired       : 100.0%
Token                  : (invoke with -T/--tokens to see all 256 tokens)w

nodetool tpstats:

显示如active、pending以及完成的任务等Cassandra操作的每个阶段的状态;

OPTIONS
        -F <format>, --format <format>
            Output format (json, yaml)
[[email protected] ~]# nodetool tpstats
Pool Name                         Active   Pending      Completed   Blocked  All time blocked
ReadStage                              0         0            140         0                 0
MiscStage                              0         0              0         0                 0
CompactionExecutor                     0         0         491131         0                 0
MutationStage                          0         0             45         0                 0
MemtableReclaimMemory                  0         0            586         0                 0
PendingRangeCalculator                 0         0             13         0                 0
GossipStage                            0         0        3150790         0                 0
.....
PerDiskMemtableFlushWriter_0           0         0            586         0                 0
ValidationExecutor                     0         0              0         0                 0
.....

Message type           Dropped
READ                         0
.........
REQUEST_RESPONSE             0
PAGED_RANGE                  0
READ_REPAIR                  0

nodetool cfstats:

显示了每个表和keyspace的统计数据;

选项
        -F <format>, --format <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
创建keyspace
create keyspace ptmind_test with replication = {‘class‘:‘NetworkTopologyStrategy‘,‘dc1‘:2} and durable_writes = true;

创建表
[email protected]:ptmind_test> CREATE TABLE users (
               ...   user_id text PRIMARY KEY,
               ...   first_name text,
               ...   last_name text,
               ...   emails set<text>
               ... );

插入数据:
INSERT INTO users (user_id, first_name, last_name, emails) VALUES(‘2‘, ‘kevin‘, ‘kevin‘, {‘[email protected]‘, ‘[email protected]‘});

查看指定表空间,默认输出所有


[[email protected] ~]# nodetool cfstats ptmind_test.users
Total 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的数量;

[[email protected] ~]# nodetool cfhistograms ptmind_test.users

No SSTables exists, unable to calculate ‘Partition Size‘ and ‘Cell Count‘ percentiles
ptmind_test/users histograms
Percentile  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

原文地址:https://blog.51cto.com/michaelkang/2418449

时间: 2024-08-01 02:29:06

Cassandra内建的工具nodetool - 监控篇的相关文章

Python3 内建模块 hashlib、itertools、HTMLParser、urllib

Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个函数,把任意长度的数据转换为一个长度固定的数据串(通常用16进制的字符串表示). 举个例子,你写了一篇文章,内容是一个字符串'how to use python hashlib - by Michael',并附上这篇文章的摘要是'2d73d4f15c0db7f5ecb321b6a65e5d6d'.如果有人篡改了你的文章,并发表为'how to use pytho

并发编程—— Java 内建线程机制【上】

不理解多线程程序设计, 就无法真正理解 JavaSE 和 JDK 源码: 因为线程特性已经与Java 语言紧密地融合在一起. 如何学习多线程程序设计呢? 那看上去似乎总是显得有些神秘.首先, 必须透彻理解并发程序设计的基本原理和机制, 否则, 只是学习使用那些关键字.类的招式,恐怕只能获得Superficial 的认识, 因为多线程程序设计的难点就在于,在任何情况下都能正确工作, easily writing programs that appear to work but will fail

Spring Boot 揭秘与实战(九) 应用监控篇 - HTTP 健康监控

文章目录 1. 内置 HealthIndicator 监控检测 2. 自定义 HealthIndicator 监控检测 3. 源代码 Health 信息是从 ApplicationContext 中所有的 HealthIndicator 的 Bean 中收集的, Spring Boot 内置了一些 HealthIndicator. 内置 HealthIndicator 监控检测 Name Description CassandraHealthIndicator Checks that a Cas

Linux编程 10 (shell外部命令与内建命令,alias ,type命令)

一.  内部命令 Linux命令有内部命令(内建命令)和外部命令之分,内部命令和外部命令功能基本相同,但也有些细微差别.内部命令不需要使用子进程来执行,它们已经和shell编译成一体,作为shell工具的组成部分存在.不需要借助外部程序文件来运行.它们是一些比较简单的linux系统命令,如exit,history,cd,echo等. 要分区是外部命令还是内部命令可以使用type  来查看,如下图查看cd是内部还是外部命令: 1.1命令别名 alias 命令也是一个内建命令,允许你为常用的命令和参

零元学Expression Design 4 - Chapter 7 使用内建功能「Clone」来达成Path的影分身之术

原文:零元学Expression Design 4 - Chapter 7 使用内建功能「Clone」来达成Path的影分身之术 本章所介绍的是便利且快速的内建工具Clone ? 本章所介绍的是便利且快速的内建工具Clone ? ? 为什麽会说像是影分身之术呢? ? 请参照火影忍者(NARUTO): <分身术>会分身术者,能以一身分出几身,几十身,乃至千百身. (此为鸣人的多重影分身之术的加强版--「後宫之术」) ? 看下去就知道 ? 01 首先,请先随意的在主要工作区画上你想要的图形 你可以

Linux Shell的父子关系及内建命令

Linux Shell的父子关系及内建命令 Shell的类型 系统启动什么样的shell程序取决于你个人的用户ID配置.在/etc/passwd文件中,在用户ID记录的第7个字段中列出了默认的shell程序.只要用户登录到某个虚拟控制台终端或是在GUI中启动终端仿真器,默认的shell程序就会开始运行. 在下面的例子中,用户xiaoyu使用了GNU bash shell作为自己的默认shell程序: 1 [email protected]:/$ cat /etc/passwd 2 [...] 3

python基础-常用内建模块

一.collections:内建集合模块. 1.namedtuple:创建一个自定义的tuple对象 2.deque:为了高效实现插入和删除操作的双向列表,适合用于队列和栈 3.defaultdict:Key不存在时返回默认值 4.OrderedDict:保持Key的顺序 5.Counter:一个简单的计数器 二.base64 : 一种用64个字符来表示任意二进制数据的方法 三.struct : str和其他二进制数据类型的转换 四.hashlib : 提供常见的摘要算法,如MD5,SHA1 五

Linux - Bash shell的功能;内建命令type

命令编修能力 (history): bash 的功能里头,相当棒的一个就是『他能记忆使用过的命令!』 这功能真的相当的棒!因为我只要在命令列按『上下键』就可以找到前/后一个输入的命令!而在很多 distribution 里头,默认的命令记忆功能可以到达 1000 个!也就是说, 你曾经下达过的命令几乎都被记录下来了. 这么多的命令记录在哪里呢?在你的家目录内的 .bash_history 啦! 不过,需要留意的是,~/.bash_history 记录的是前一次登陆以前所运行过的命令, 而至于这一

什么是Bash Shell的内建(build in)命令

1.什么是build in命令: shell内建命令是指bash(或其它版本)工具集中的命令.一般都会有一个与之同名的系统命令,比如bash中的echo命令与/bin/echo是两个不同的命令,尽管他们行为大体相仿.当在bash中键入一个命令时系统会先看他是否是一个内建命令,如果不是才会查看是否是系统命令或第三方工具.所以在bash中键入echo命令实际上执行bash工具集中的bash命令也就是内建命令,而不是/bin/echo这个系统命令. 2.内建命令与系统命令 内建命令要比系统论命令有比较