nodetool getendpoints
Returns the endpoints that own the partition key.
Synopsis
nodetool [<connection_options>] getendpoints
[--] <keyspace_name> <table_name> <partition_key>
Definition
If a parameter has multiple forms, the following reference provides both the short form and long form, separated by a comma.
Connection options
- -h, --host hostname
-
The hostname or IP address of a remote node or nodes. When omitted, the default is the local machine.
- -p, --port jmx_port
-
The JMX port number.
- -pw, --password jmxpassword
-
The JMX password for authenticating with secure JMX. If a password is not provided, you are prompted to enter one.
- -pwf, --password-file jmx_password_filepath
-
The file path to the file that stores JMX authentication credentials.
- -u, --username jmx_username
-
The username for authenticating with secure JMX.
Command arguments
---
Separates an option from an argument that could be mistaken for an option.
- key
-
Partition key of the end points you want to get.
- keyspace_name
-
The keyspace name.
- table_name
-
The table name.
Examples
The partitioner returns a token for the key. HCD returns an endpoint regardless of whether data exists on the identified node for that token.
Consider the following table created in the cycling keyspace, which uses a primary key of race_year and race_name:
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);
-
Run
nodetool getendpointswith a value from the partition key:nodetool getendpoints cycling rank_by_year_and_name "2014"Result is the IP address of the replica that owns the partition key.
-
Get endpoints that own partition key for full primary key
nodetool getendpoints cycling rank_by_year_and_name "2014:4th Tour of Beijing"Result is the IP address of the replica that owns the partition key.