diff --git a/CHANGES.txt b/CHANGES.txt index 4b9085a4a6..223f331410 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -32,6 +32,7 @@ Merged from 2.0: * cqlsh: Accept and execute CQL statement(s) from command-line parameter (CASSANDRA-7172) * Fix IllegalStateException in CqlPagingRecordReader (CASSANDRA-7198) * Fix the InvertedIndex trigger example (CASSANDRA-7211) + * Add --resolve-ip option to 'nodetool ring' (CASSANDRA-7210) Merged from 1.2: * Add Cloudstack snitch (CASSANDRA-7147) * Update system.peers correctly when relocating tokens (CASSANDRA-7126) diff --git a/src/java/org/apache/cassandra/tools/NodeTool.java b/src/java/org/apache/cassandra/tools/NodeTool.java index faa2a7d2ad..8f2f26165a 100644 --- a/src/java/org/apache/cassandra/tools/NodeTool.java +++ b/src/java/org/apache/cassandra/tools/NodeTool.java @@ -424,6 +424,9 @@ public class NodeTool @Arguments(description = "Specify a keyspace for accurate ownership information (topology awareness)") private String keyspace = null; + @Option(title = "resolve_ip", name = {"-r", "--resolve-ip"}, description = "Show node domain names instead of IPs") + private boolean resolveIp = false; + @Override public void execute(NodeProbe probe) { @@ -455,7 +458,7 @@ public class NodeTool System.out.printf("Note: Ownership information does not include topology; for complete information, specify a keyspace%n"); } System.out.println(); - for (Entry entry : getOwnershipByDc(probe, false, tokensToEndpoints, ownerships).entrySet()) + for (Entry entry : getOwnershipByDc(probe, resolveIp, tokensToEndpoints, ownerships).entrySet()) printDc(probe, format, entry.getKey(), endpointsToTokens, entry.getValue()); if (DatabaseDescriptor.getNumTokens() > 1) @@ -529,7 +532,7 @@ public class NodeTool ? loadMap.get(endpoint) : "?"; String owns = stat.owns != null ? new DecimalFormat("##0.00%").format(stat.owns) : "?"; - System.out.printf(format, endpoint, rack, status, state, load, owns, stat.token); + System.out.printf(format, stat.ipOrDns(), rack, status, state, load, owns, stat.token); } System.out.println(); }