The dsetool

Use the dsetool utility for Cassandra File System (CFS) and Hadoop-related tasks, such as managing the job tracker, checking the CFS, and listing node subranges of data in a keyspace.

You can use the dsetool utility for Cassandra File System (CFS) and Hadoop-related tasks, such as managing the job tracker, checking the CFS, and listing node subranges of data in a keyspace. Only JMX (java management extensions) provides dsetool password authentication. If JMX passwords are enabled, users must use the passwords to use the dsetool utility.

Synopsis:
$ dsetool [-f config_file] [-l username -p password] [-a jmx_username -b jmx_password]  [-h=hostname] [-s=Solr_port] [-j=jmx_port] command args
Legend
Syntax conventions Description
Italics or <value> Variable value. Replace with a user-defined value. Do not type the angle brackets.
[ ] Optional. Square brackets ( [ ] ) surround optional command arguments. Do not type the square brackets.
( ) Group. Parentheses ( ( ) ) identify a group to choose from. Do not type the parentheses.
| Or. A vertical bar ( | ) separates alternative elements. Type any one of the elements. Do not type the vertical bar.
[ -- ] Separate the command line options from the command arguments with two hyphens ( -- ). This syntax is useful when arguments might be mistaken for command line options.

You can provide user credentials in several ways, see internal authentication.

This table describes the dsetool arguments:

Short form Long form Description
-f   Path to configuration file that stores credentials. If not specified, then use ~/.dserc if it exists.
-a --jmx-username <arg> User name for authenticating with secure JMX.
-b --jmx-password <arg> Password for authenticating with secure JMX.
-h --host <arg> Node hostname or IP address.
-j --jmxport <arg> Remote JMX agent port number.
-s --port <arg> Solr port to use.
-u --use_hadoop_config Get cassandra host from Hadoop configuration files.

The dsetool commands are:

checkcfs
Check a single CFS file or the whole CFS.
create_core <keyspace.cf>
Creates the Solr core and optionally generates resources automatically. The Solr core is created with the specified keyspace and table name and following options:
  • schema=<path> - path of the schema file used for creating the core, not necessary when generateResources=true
  • solrconfig=<path> - path of the solrconfig file used for creating the core, not necessary when generateResources=true
  • distributed=<true|false> - default: true
  • recovery=<true|false> - default: false
  • deleteAll=<true|false> - default: false
  • reindex=<true|false> - only observed on auto-core creation (generateResources=true); otherwise, always reindexes on core creation. Default: false
  • generateResources=<true|false> - default: false
  • coreOptions - path to the options file when generateResources=true
createsystemkey <algorithm[/mode/padding]> <Key Strength> [<Path>]
Creates a system key for SSTable encryption. Key strength is not required for HMAC algorithms.
encryptconfigvalue
Encrypts sensitive configuration information. This command takes no arguments and prompts for the value to encrypt.
infer_solr_schema <keyspace>.<table> [coreOptions <path_to_options_file>]
Automatically generates a schema based on the specified keyspace and table. Solr cores are not modified, the schema is inferred and proposed.
inmemorystatus [<keyspace> <table>]
Provides the memory size, capacity, and percentage for this node and the amount of memory each table is using. To get information about a single table, specify keyspace and table. The unit of measurement is MB. Bytes are truncated.
get_core_schema <keyspace>.<table> [current=true|false]
Provides the Solr schema as the output of this command. If current is set to true, returns the current live schema.
get_core_config <keyspace>.<table> [current=true|false]
Provides the solrconfig as the output of this command. If current is set to true, returns the current live solrconfig.
jobtracker
Return the job tracker hostname and port. Returns Jobtracker local to the datacenter from which you are running the command.
listjt
List all job tracker nodes grouped by DC local to them.
list_subranges <keyspace> <cf-name> <keys_per_range> <start_token>, <end_token>
Divide a token range for a given keyspace/table into a number of smaller subranges of approximately keys_per_range. To be useful, the specified range should be contained by the target node's primary range.
movejt
Move the job tracker and notify the task tracker nodes.
partitioner
Return the fully qualified classname of the IPartitioner in use by the cluster
reload_core <keyspace>.<table> [<<option>> ...]
Reloads a core with the given keyspace and table name and following options:
  • schema=<path> - path of the schema file used for reloading the core
  • solrconfig=<path> - path of the solrconfig file used for reloading the core
  • distributed=<true|false> - default: true
  • deleteAll=<true|false> - default: false
  • reindex=<true|false> - default: false
perf <subcommand>
Modifies performance object settings as described in the subcommand section.
repaircfs
Repair the CFS from orphan blocks.
rebuild_indexes <keyspace> <table-name> [<idx1,idx2,...>]
Rebuild specified secondary indexes for given keyspace/table. Use only keyspace/table-name to re-build all indexes.
ring
List the nodes in the ring including their node type.
sparkmaster [ <subcommand>]
Unless a subcommand is provided, this command returns the hostname and port of Spark Master running in a data center. Otherwise, this command executes a subcommand related to Spark Master.
  • cleanup - Drop and recreate the Spark Master recovery table.
  • cleanup <data-center-name> - Remove recovery data for the specified data center.
  • credentials <username> <password> - Change the username and password used by Spark Master to login to Cassandra and store the recovery data.
sparkworker restart
Manually restarts the Spark Worker on the selected node, without restarting the node.
status
Same as the ring command.

Examples of using dsetool commands for managing the job tracker are presented in Managing the job tracker using dsetool commands.

Checking the CFS using dsetool 

Use the dsetool checkcfs command to scan the Cassandra File System (CFS) for corrupted files. For example:
dsetool checkcfs cfs:///
Use the dsetool to get details about a particular file that has been corrupted. For example:
dsetool checkcfs /tmp/myhadoop/mapred/system/jobtracker.info

Listing sub-ranges using dsetool 

The dsetool command syntax for listing subranges of data in a keyspace is:
dsetool [-h ] [hostname ] list_subranges <keyspace> <table> <rows per subrange> <start token> <end token>
  • rows per subrange is the approximate number of rows per subrange.
  • start partition range is the start range of the node.
  • end partition range is the end range of the node.
Note: You run nodetool repair on a single node using the output of list_subranges. The output must be partition ranges used on that node.
Example
dsetool list_subranges Keyspace1 Standard1 10000 113427455640312821154458202477256070485 0

Output

The output lists the subranges to use as input to the nodetool repair command. For example:
Start Token                             End Token                               Estimated Size
------------------------------------------------------------------------------------------------
113427455640312821154458202477256070485 132425442795624521227151664615147681247 11264
132425442795624521227151664615147681247 151409576048389227347257997936583470460 11136
151409576048389227347257997936583470460 0                                       11264

Nodetool repair command options

You need to use the nodetool utility when working with sub-ranges. The start partition range (-st) and end partition range (-et) options specify the portion of the node needing repair. You get values for the start and end tokens from the output of dsetool list_subranges command. The new nodetool repair syntax for using these options is:
nodetool repair <keyspace> <table> -st <start token>  -et <end token>
Example
nodetool repair Keyspace1 Standard1 -st 113427455640312821154458202477256070485 -et 132425442795624521227151664615147681247 
nodetool repair Keyspace1 Standard1 -st 132425442795624521227151664615147681247 -et 151409576048389227347257997936583470460
nodetool repair Keyspace1 Standard1 -st 151409576048389227347257997936583470460 -et 0

These commands begins an anti-entropy node repair from the start partition range to the end partition range.

Performance object subcommands 

The self-explanatory dsetool perf command subcommands are:
Note: Enabling or disabling in this fashion will not persist between reboots and are only useful for short-term diagnostics. To make these settings permanent, see CQL Performance Service options.
Performance object subcommands
Subcommand name Possible values Description
clustersummary enable|disable Toggle cluster summary statistics. See Collecting database summary diagnostics.
cqlslowlog <threshold> Set the CQL slow log threshold. See Collecting slow queries.
cqlslowlog enable|disable Toggle the CQL slow log.
cqlsysteminfo enable|disable Toggle CQL system information statistics. See Collecting system level diagnostics.
dbsummary enable|disable Toggle database summary statistics. See Collecting database summary diagnostics.
histograms enable|disable Toggle table histograms. See Collecting table histogram diagnostics.
resourcelatencytracking enable|disable Toggle resource latency tracking. See Collecting system level diagnostics.
userlatencytracking enable|disable Toggle user latency tracking. See Collecting user activity diagnostics.

Solr Performance object subcommands 

The self-explanatory dsetool perf command subcommands are:
Note: Enabling or disabling in this fashion will not persist between reboots and are only useful for short-term diagnostics. To make these settings permanent, see Solr Performance Service options.
Solr Performance object subcommands
Subcommand name Possible values Description
solrcachestats enable|disable Toggle Solr cache statistics. See Collecting cache statistics.
solrindexingerrorlog enable|disable Toggle Solr indexing error log. See Collecting indexing errors.
solrindexstats enable|disable Toggle Solr index statistics. See Collecting index statistics.
solrlatencysnapshots enable|disable Toggle Solr latency snapshots. See Query latency snapshot.
solrrequesthandlerstats enable|disable Toggle Solr request handler statistics. See Collecting handler statistics.
solrslowlog enable|disable Toggle Solr slow sub-query log. See Collecting slow Solr queries.
solrupdatehandlerstats enable|disable Toggle Solr update handler statistics. See Update request handler statistics.

Using dsetool with Kerberos 

To use dsetool with Kerberos, use one of these methods:
  • Using the ~/.dserc file
    Create or edit the ~/.dserc file in your DataStax Enterprise home directory and add the following entries:
    sasl_protocol=service_name
    login_config=path_to_login_config
  • Command line options
    Specify the service name and JAAS configuration file on the command line:
    -Ddse.sasl.protocol=service_name
    -Djava.security.auth.login.config=path_to_login_config
    where:
    • service_name is the service name component of the service_principal that is defined in the dse.yaml file
    • path_to_login_config is the JAAS configuration file with the following options declared in it:
      DseClient {
                  com.sun.security.auth.module.Krb5LoginModule required
                  useTicketCache=true
                  renewTGT=true;
              };