您好,登錄后才能下訂單哦!
Cassandra 自帶了多個功能強大集群或數據管理工具,數量掌握有助于診斷和維護Cassandra集群、快速解決各種問題:
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 help
nodetool help command-name
nodetool help status
nodetool工具集提供了一批用于查看表的指標、服務器指標和壓縮統計。
輸出集群信息
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]
輸出集群環的快速摘要和集群的當前狀況;
[root@kubm-01 ~]# 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
顯示網絡連接操作的統計數據;
[root@kubm-01 ~]# 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
[ptmind@kubm-01 ~]$ 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
顯示如active、pending以及完成的任務等Cassandra操作的每個階段的狀態;
OPTIONS
-F <format>, --format <format>
Output format (json, yaml)
[root@kubm-01 ~]# 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
顯示了每個表和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;
創建表
cassandra@cqlsh: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', {'kevin@ptmind.com', 'kevin@gmail.com'});
[root@kubm-01 ~]# 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
顯示表的統計數據,包括讀寫延遲,行大小,列的數量和SSTable的數量;
[root@kubm-01 ~]# 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
顯示當前正在壓縮的任務進度
pending tasks: 0
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。