Search code examples
cassandracql3cassandra-3.0

determine node of a partition in Cassandra


This is maybe a special question but is it possible to determine the node(s) of a partion key?

example: I have a partition key id (int) and I'm using the default Partitioner(Murmur3Partitioner) with 3 nodes and replication factor "1". Can I determine the one node with id = 3?

CREATE TABLE example_table (
    id int,    
    content text,
    PRIMARY KEY (id, content)
) 

Solution

  • You can use nodetool getendpoints <keyspace> <table> <partition_key>

    or you can use select token(<partition_key>) from <table_name> and then run nodetool ring.

    Check also this for further info