Vcrisan
Vcrisan

Reputation: 11

cassandra nodetool/cqlsh describe cluster

I am testing Cassandra on a 3 nodes cluster on Google cloud and trying to see the Ranges Ownership distribution between the nodes ( I have an RF = 3 for the test keyspace). I have tried both CQL describe cluster and Nodetool describecluster but none of them shows as well the ranges (only snitch, partitioner and schema versions). Running cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 . Any idea how can I find this info or why these commands don't display these? Might be because of the cluster setup? Thanks.

Upvotes: 1

Views: 2402

Answers (2)

Aaron
Aaron

Reputation: 57808

From within CQL, you can query the system.local table. This table exists on each node, contains only a single row, and holds data specific to the node itself. The tokens column contains the same data as is returned via the nodetool ring command:

> SELECT tokens FROM system.local ;

 tokens
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {'-1221474524472000659', '-2679404716758606376', '-9167452864191410895', '-9208108764127114640', '1685199701625160019', '1767371464207122869', '5004977198676178684', '5337137237744686089', '6630117681615088706', '7106607077939671384', '7512974951531203644', '8229478807809310370'}

(1 rows)

Note that querying tokens via system.local returns only the token ranges for the current node. To see them for another node in the cluster, you can query the tokens column on the system.peers table, where they are keyed by IP Address (peer).

> SELECT tokens FROM system.peers WHERE peer='192.168.6.114';

 tokens
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {'-4094626707569673185', '-5633637686310353556', '-6167080457205238021', '-6475599470116582717', '-6726897113409283403', '-7185540759553541576', '-7282762652579832116', '-7740824590733013501', '-8045274855112430621', '2064433256459654945', '667061811731435593', '7079292008020861651'}

(1 rows)

Upvotes: 1

root
root

Reputation: 3957

can you try nodetool ring

The token column provides the end of the token range up to and including the value listed.

Read here https://docs.datastax.com/en/cassandra/2.1/cassandra/tools/toolsRing.html

Upvotes: 0

Related Questions