Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

nodetool getendpoints

Displays the replica nodes for a specific partition key.


Terminal window
nodetool [connection_options] getendpoints <keyspace> <table> <key>

See connection options for connection options.

nodetool getendpoints shows which nodes store replicas for a given partition key. This is useful for debugging data placement, understanding query routing, and troubleshooting replication issues.


ArgumentDescription
keyspaceThe keyspace containing the table
tableThe table to query
keyThe partition key value

192.168.1.101
192.168.1.102
192.168.1.103

Lists all replica endpoints that store data for the specified partition key.


Terminal window
nodetool getendpoints my_keyspace users 550e8400-e29b-41d4-a716-446655440000
Terminal window
nodetool getendpoints my_keyspace customers "customer_123"
Terminal window
nodetool getendpoints my_keyspace orders 12345

For composite partition keys, use colon-separated values:

Terminal window
nodetool getendpoints my_keyspace events "2024-01-15:sensor_001"

Terminal window
# Where is this user's data stored?
nodetool getendpoints my_app users "user@example.com"
Terminal window
# Check if RF=3 is working
endpoints=$(nodetool getendpoints my_keyspace my_table "key123")
echo "$endpoints" | wc -l
# Should output: 3
Terminal window
# Find replicas, then query each directly
REPLICAS=$(nodetool getendpoints my_keyspace my_table "problem_key")
for host in $REPLICAS; do
echo "=== $host ==="
cqlsh $host -e "SELECT * FROM my_keyspace.my_table WHERE pk = 'problem_key';"
done
Terminal window
# See which nodes a driver will contact for this key
nodetool getendpoints my_keyspace my_table "hot_partition"

Terminal window
$ nodetool getendpoints my_keyspace my_table "key1"
192.168.1.101
192.168.1.102
192.168.1.103

The partition is stored on these 3 nodes.

Terminal window
$ nodetool getendpoints my_keyspace my_table "key1"
192.168.1.101 # DC1
192.168.1.102 # DC1
192.168.1.103 # DC1
192.168.2.101 # DC2
192.168.2.102 # DC2
192.168.2.103 # DC2

Shows replicas in both datacenters.


  1. Cassandra computes token = hash(partition_key)
  2. Finds the node owning that token on the ring
  3. Returns that node plus RF-1 subsequent nodes (or per-DC replicas)
partition_key → hash → token → primary replica → replica list

Key TypeExample Command
UUIDnodetool getendpoints ks tbl 550e8400-e29b-...
Textnodetool getendpoints ks tbl "my_string"
Intnodetool getendpoints ks tbl 12345
Compositenodetool getendpoints ks tbl "part1:part2"

check_key_distribution.sh
#!/bin/bash
KS=$1
TBL=$2
while read key; do
echo "Key: $key"
nodetool getendpoints $KS $TBL "$key"
echo "---"
done < keys.txt
#!/bin/bash
# Find which nodes own suspected hot partitions
for key in "hot_key_1" "hot_key_2" "hot_key_3"; do
echo "=== $key ==="
nodetool getendpoints my_keyspace my_table "$key"
done | sort | uniq -c | sort -rn
#!/bin/bash
# Ensure key has replicas in both DCs
KEY=$1
ENDPOINTS=$(nodetool getendpoints my_keyspace my_table "$KEY")
DC1_COUNT=$(echo "$ENDPOINTS" | grep "192.168.1" | wc -l)
DC2_COUNT=$(echo "$ENDPOINTS" | grep "192.168.2" | wc -l)
echo "DC1 replicas: $DC1_COUNT"
echo "DC2 replicas: $DC2_COUNT"

If the table doesn’t exist or keyspace is wrong:

Table 'my_keyspace.nonexistent' does not exist

For composite partition keys, ensure correct format:

Terminal window
# Wrong (for composite key)
nodetool getendpoints ks tbl "value1" "value2"
# Correct (colon-separated)
nodetool getendpoints ks tbl "value1:value2"

CommandRelationship
ringToken distribution overview
describeringToken ranges with replicas
statusNode status and load
gossipinfoDetailed node information