refactor nodetool, encapsulating each command into a subclass

patch by Clément Lardeur; reviewed by Mikhail Stepura for CASSANDRA-6381
This commit is contained in:
Jonathan Ellis 2014-01-10 12:08:04 -06:00
parent eca02fd255
commit 892d8e699c
7 changed files with 2148 additions and 2032 deletions

View File

@ -90,6 +90,6 @@ esac
-Xmx32m \
-Dlogback.configurationFile=logback-tools.xml \
-Dstorage-config="$CASSANDRA_CONF" \
org.apache.cassandra.tools.NodeCmd -p $JMX_PORT $ARGS
org.apache.cassandra.tools.NodeTool -p $JMX_PORT $ARGS
# vi:ai sw=4 ts=4 tw=0 et

View File

@ -384,6 +384,7 @@
<dependency groupId="com.addthis.metrics" artifactId="reporter-config" version="2.1.0" />
<dependency groupId="edu.stanford.ppl" artifactId="snaptree" version="0.1" />
<dependency groupId="org.mindrot" artifactId="jbcrypt" version="0.3m" />
<dependency groupId="io.airlift" artifactId="airline" version="0.6" />
<dependency groupId="io.netty" artifactId="netty" version="3.6.6.Final" />
<dependency groupId="com.google.code.findbugs" artifactId="jsr305" version="2.0.2" />
<dependency groupId="com.clearspring.analytics" artifactId="stream" version="2.5.1" />
@ -418,6 +419,7 @@
<dependency groupId="org.apache.pig" artifactId="pig"/>
<dependency groupId="net.java.dev.jna" artifactId="jna"/>
<dependency groupId="com.google.code.findbugs" artifactId="jsr305"/>
<dependency groupId="io.airlift" artifactId="airline"/>
</artifact:pom>
<artifact:pom id="coverage-deps-pom"

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,7 @@ import org.apache.cassandra.utils.SimpleCondition;
/**
* JMX client operations for Cassandra.
*/
public class NodeProbe
public class NodeProbe implements AutoCloseable
{
private static final String fmtUrl = "service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi";
private static final String ssObjName = "org.apache.cassandra.db:type=StorageService";

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.cassandra.tools;
import java.util.List;
public class NodeToolHelp
{
public List<NodeToolCommand> commands;
public static class NodeToolCommand
{
public String name;
public String help;
public String toString()
{
return name;
}
}
}

View File

@ -1,217 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Help file for nodetool commands in Yaml.
commands:
- name: ring
help: |
Print information about the token ring
- name: join
help: |
Join the ring
- name: info [-T/--tokens]
help: |
Print node information (uptime, load, ...)
- name: status
help: |
Print cluster information (state, load, IDs, ...)
- name: cfstats [keyspace].[cfname] ...
help: |
Print statistics on column families. Use the -i flag to ignore the list of column families and display the remaining cfs.
- name: version
help: |
Print cassandra version
- name: tpstats
help: |
Print usage statistics of thread pools
- name: proxyhistograms
help: |
Print statistic histograms for network operations
- name: drain
help: |
Drain the node (stop accepting writes and flush all column families)
- name: decommission
help: |
Decommission the *node I am connecting to*
- name: compactionstats
help: |
Print statistics on compactions
- name: compactionhistory
help: |
Print history of compaction
- name: disablebinary
help: |
Disable native transport (binary protocol)
- name: enablebinary
help: |
Reenable native transport (binary protocol)
- name: statusbinary
help: |
Status of native transport (binary protocol)
- name: disablehandoff
help: |
Disable the future hints storing on the current node
- name: enablehandoff
help: |
Reenable the future hints storing on the current node
- name: truncatehints <host-name>
help: |
Truncate all hints on the local node, or truncate hints for the endpoint specified.
- name: resumehandoff
help: |
Resume hints delivery process
- name: pausehandoff
help: |
Pause hints delivery process
- name: disablegossip
help: |
Disable gossip (effectively marking the node down)
- name: enablegossip
help: |
Reenable gossip
- name: disablethrift
help: |
Disable thrift server
- name: enablethrift
help: |
Reenable thrift server
- name: enablebackup
help: |
Enable incremental backup
- name: disablebackup
help: |
Disable incremental backup
- name: statusthrift
help: |
Status of thrift server
- name: gossipinfo
help: |
Shows the gossip information for the cluster
- name: invalidatekeycache
help: |
Invalidate the key cache
- name: invalidaterowcache
help: |
Invalidate the row cache
- name: resetlocalschema
help: |
Reset node's local schema and resync
- name: netstats [host]
help: |
Print network information on provided host (connecting node by default)
- name: move <new token>
help: |
Move node on the token ring to a new token. (for negative tokens, use \\ to escape, Example: move \\-123)
- name: removenode status|force|<ID>
help: |
Show status of current node removal, force completion of pending removal or remove provided ID
- name: setcompactionthroughput <value_in_mb>
help: |
Set the MB/s throughput cap for compaction in the system, or 0 to disable throttling.
- name: setstreamthroughput <value_in_mb>
help: |
Set the MB/s throughput cap for streaming in the system, or 0 to disable throttling.
- name: describecluster
help: |
Print the name, snitch, partitioner and schema version of a cluster.
- name: describering [keyspace]
help: |
Shows the token ranges info of a given keyspace.
- name: rangekeysample
help: |
Shows the sampled keys held across all keyspaces.
- name: rebuild [src-dc-name]
help: |
Rebuild data by streaming from other nodes (similarly to bootstrap)
- name: settraceprobability [value]
help: |
Sets the probability for tracing any given request to value. 0 disables, 1 enables for all requests, 0 is the default
- name: snapshot [keyspaces...] -cf [columnfamilyName] -t [snapshotName]
help: |
Take a snapshot of the optionally specified column family of the specified keyspaces using optional name snapshotName
- name: clearsnapshot [keyspaces...] -t [snapshotName]
help: |
Remove snapshots for the specified keyspaces. Either remove all snapshots or remove the snapshots with the given name.
- name: flush [keyspace] [cfnames]
help: |
Flush one or more column families
- name: repair [keyspace] [cfnames]
help: |
Repair one or more column families
Use -dc to repair specific datacenters (csv list).
Use -et to specify a token at which repair range ends.
Use -local to only repair against nodes in the same datacenter.
Use -pr to repair only the first range returned by the partitioner.
Use -par to carry out a parallel repair.
Use -st to specify a token at which the repair range starts.
- name: cleanup [keyspace] [cfnames]
help: |
Run cleanup on one or more column families
- name: compact [keyspace] [cfnames]
help: |
Force a (major) compaction on one or more column families
- name: scrub [keyspace] [cfnames]
help: |
Scrub (rebuild sstables for) one or more column families
- name: upgradesstables [-a|--include-all-sstables] [keyspace] [cfnames]
help: |
Rewrite sstables (for the requested column families) that are not on the current version (thus upgrading them to said current version).
Use -a to include all sstables, even those already on the current version.
- name: setcompactionthreshold <keyspace> <cfname>
help: |
Set min and max compaction thresholds for a given column family
- name: getcompactionthreshold <keyspace> <cfname>
help: |
Print min and max compaction thresholds for a given column family
- name: disableautocompaction [keyspace] [cfnames]
help: |
Disable autocompaction for the given keyspace and column family
- name: enableautocompaction [keyspace] [cfnames]
help: |
Enable autocompaction
- name: getcompactionthroughput
help: |
Print the MB/s throughput cap for compaction in the system
- name: getstreamthroughput
help: |
Print the MB/s throughput cap for streaming in the system
- name: stop <compaction_type>
help: |
Supported types are COMPACTION, VALIDATION, CLEANUP, SCRUB, INDEX_BUILD
- name: cfhistograms <keyspace> <cfname>
help: |
Print statistic histograms for a given column family
- name: refresh <keyspace> <cf-name>
help: |
Load newly placed SSTables to the system without restart.
- name: rebuild_index <keyspace> <cf-name> <idx1,idx1>
help: |
a full rebuilds of native secondry index for a given column family. IndexNameExample: Standard3.IdxName,Standard3.IdxName1
- name: setcachecapacity <key-cache-capacity> <row-cache-capacity>
help: |
Set global key and row cache capacities (in MB units).
- name: setcachekeystosave <key-cache-keys-to-save> <row-cache-keys-to-save>
help: |
Set number of keys saved by each cache for faster post-restart warmup. 0 to disable.
- name: getendpoints <keyspace> <cf> <key>
help: |
Print the end points that owns the key
- name: getsstables <keyspace> <cf> <key>
help: |
Print the sstable filenames that own the key
- name: reloadtriggers
help: |
reload trigger classes