nodetool getendpoints

Provides the IP addresses or names of replicas that own the partition key.

Synopsis

nodetool <options> getendpoints -- <keyspace> <table> key

Tarball and Installer No-Services path:

<installation_location>/resources/cassandra/bin
Connection options
Short Long Description

-h

--host

Hostname or IP address.

-p

--port

Port number.

-pwf

--password-file

Password file path.

-pw

--password

Password.

-u

--username

Remote JMX agent username.

keyspace

Name of keyspace.

table

Name of table.

key

Partition key of the end points you want to get.

--

Separates an option from an argument that could be mistaken for an option.

Example

For example, which nodes own partition key_1, key_2, and key_3?

The partitioner returns a token for the key. DataStax Enterprise returns an endpoint whether or not data exists on the identified node for that token.

 $ nodetool -h 127.0.0.1 -p 7100 getendpoints myks mytable key_1
127.0.0.2
 $ nodetool -h 127.0.0.1 -p 7100 getendpoints myks mytable key_2
127.0.0.2

For example, consider the following table, which uses a primary key of race_year and race_name. This table is created in the cycling keyspace.

CREATE TABLE cycling.rank_by_year_and_name (
    race_year int,
    race_name text,
    rank int,
    cyclist_name text,
    PRIMARY KEY ((race_year, race_name), rank)
) WITH CLUSTERING ORDER BY (rank ASC);
INSERT INTO cycling.rank_by_year_and_name (race_year, race_name, cyclist_name, rank) VALUES (2015, 'Tour of Japan - Stage 4 - Minami > Shinshu', 'Benjamin PRADES', 1);
INSERT INTO cycling.rank_by_year_and_name (race_year, race_name, cyclist_name, rank) VALUES (2015, 'Tour of Japan - Stage 4 - Minami > Shinshu', 'Adam PHELAN', 2);
INSERT INTO cycling.rank_by_year_and_name (race_year, race_name, cyclist_name, rank) VALUES (2015, 'Tour of Japan - Stage 4 - Minami > Shinshu', 'Thomas LEBAS', 3);
INSERT INTO cycling.rank_by_year_and_name (race_year, race_name, cyclist_name, rank) VALUES (2015, 'Giro d''Italia - Stage 11 - Forli > Imola', 'Ilnur ZAKARIN', 1);
INSERT INTO cycling.rank_by_year_and_name (race_year, race_name, cyclist_name, rank) VALUES (2015, 'Giro d''Italia - Stage 11 - Forli > Imola', 'Carlos BETANCUR', 2);
INSERT INTO cycling.rank_by_year_and_name (race_year, race_name, cyclist_name, rank) VALUES (2014, '4th Tour of Beijing', 'Phillippe GILBERT', 1);
INSERT INTO cycling.rank_by_year_and_name (race_year, race_name, cyclist_name, rank) VALUES (2014, '4th Tour of Beijing', 'Daniel MARTIN', 2);
INSERT INTO cycling.rank_by_year_and_name (race_year, race_name, cyclist_name, rank) VALUES (2014, '4th Tour of Beijing', 'Johan Esteban CHAVES', 3);

Given the previous information that was inserted into the table, run nodetool getendpoints and enter a value from the partition key. For example:

nodetool getendpoints cycling rank_by_year_and_name "2014"
10.255.100.150

The resulting output is the IP address of the replica that owns the partition key. Alternatively, you can specify values that comprise the full primary key. For example:

nodetool getendpoints cycling rank_by_year_and_name "2014:4th Tour of Beijing"
10.255.100.150

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com