nodetool sjk

Runs Swiss Java Knife (SJK) commands to execute, troubleshoot, and monitor the database using MBeans.

Runs Swiss Java Knife (SJK) commands to execute, troubleshoot, and monitor the database using MBeans.

Synopsis

nodetool sjk options command command_options
Cassandra tarball installations:
installation_location/cassandra/bin

Nodetool general options

The following options apply to all nodetool commands.

Table 1. 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.
-- Separates an option from an argument that could be mistaken for a option.

Options

General Swiss Java Knife options.

--commands
Displays a list of all SJK commands.
--help
Displays command specific help, for example nodetool sjk ttop --help.
-X, --verbose
Displays detailed diagnostics.

Commands

DataStax supports running SJK commands from nodetool.

mxdump

Prints serialized MBeans to JSON format.
Warning:

The nodetool sjk mxdump command tries to print all exposed MBeans to the console. The command can fail if it encounters an improperly formatted MBean that exposes a non-serializable type. To interact with a specific list of MBeans, use the nodetool sjk mx command.

Run the nodetool sjk mx command with the -q (query) switch to avoid errors if a non-serializable type (such as an mx4j MBean) is returned.

-q, --query

Output selected MBeans by specifying the ObjectName; match patterns using the asterisk (*) and question mark (?) wildcards.

For example, to get all values for Garbage Collector:
nodetool sjk mxdump -q java.lang:type=GarbageCollector,name=*

gc

Print GC (garbage collection) log messages for remote process.

For example, to print the GC log messages:
nodetool sjk gc
Note: No options for GC.

hh

Heap histogram (hh) prints the class histogram, similar to jmap -histo. When no options are specified, prints complete histogram for all objects.

Note: For package installations, run nodetool with the account the runs the database.
For example, to print a histogram for young with a sample duration of 10000 milliseconds on a system with Cassandra package installation:
sudo -u cassandra nodetool sjk hh --young --sample-depth 10000ms -n 10
-d, --sample-depth
Specify an integer and unit to set the sample duration for --dead-young or --young; default: 10000ms. To set the unit, use the following notation:
  • ms (milliseconds)
  • s (seconds)
  • m (minutes)
  • h (hours)
  • d (days)
--dead
Prints histogram of dead objects.
--dead-young
Prints histogram for sample of dead young objects. Use with -d to set the duration.
--live
Prints histogram of live objects.
-n, --top-number
Limits the number of buckets for N top buckets; default: 2147483647.
--young
Prints histrogram for a sample of the new objects. Use with -d to set the duration.

mx

Provides query and execution for Mbeans from the nodetool interface.

-all, --allMatched
Process all matched MBeans.
-a, --arguments
Arguments for MBean operation invocation.
-f, --field, --attribute
MBean attribute
-b, --bean
Mbean name.
-mc, --call
Invokes MBean method. Default false.
-mg, --get
Retrieves value of MBean attribute. Default false.
-mi, --info
Display metadata for MBean. Default false.
--max-col-width
Table column width threshold for formatting tabular data. Default 40.
-op, --operation
MBean operation name to be called.
--quiet
Avoid non-essential output; default: false.
-ms, --set
Sets value for MBean attribute; default: false.
-v, --value
Value to set for MBean attribute.

jps

Enhanced version of jps tool from the Java Development Kit (JDK) that lists the instrumented HotSpot Java Virtual Machines (JVMs) on the target system.

-fd, --filter-description

Use a wildcard expression to match the process description.

-fp, --filter-property
Use a wildcard expressions to match JVM system properties.
-pd, --process-details
Prints custom information related to a process; set to PID, MAIN, FDQN_MAIN, ARGS, Dsys-prop, or Dsys-prop.
Xjvm-flag
Prints custom information related to the specified JVM flag.

stcap

Stack Capture dumps stack traces to file for further processing.

-e, --empty
Set to true to retain threads without stack trace in dump (ignored by default); default: false.
-f, --filter
Filters threads by name using Java RegEx syntax; default: .*
Note: The default value, period (.) followed by asterisk (*), allows any number of any characters, including nulls.
-l, --limit
Target number of traces to collect, once reached command terminates where 0 is unlimited; default: 0.
-m, --match-frame
Set to filtering string and only traces containing are included in the dump.
-o, --output
Write the thread dump to the specified a file name.
-r, --rotate
When specified output file would be rotated every N traces. Specify 0 for no rotation; default: 0.
-i, --sampler-interval
Interval between polling MBeans; default: 0.
-t, --timeout
Time until command terminate even without enough traces collected; default: 30000.

stcpy

Stack Copy utility copies and filters dumps.

-e, --empty
Set to true to retain threads without stack trace in dump (ignored by default); default: false.
-i, --input
Input files.
--mask
One or more masking rules, for example com.mycompany:com.somecompany; default: null.
-m, --match-frame
Frame filter, only traces containing the string are included in dump.
-o, --output
Set to filename. Writes thread dump to the specified file.
-ss, --subsample
If below 1.0 some frames are randomly thrown away. For example, 0.1 retains only every 10th frame; default: 1.0.
-tf, --thread-filter
Filter threads by name using Java RegEx syntax; default: .*

ssa

Stack Sample Analyzer for stack trace dumps.

--categorize
Prints summary for provided categorization; no summary printed by default.
-cf, --categorizer-file
Path to file with stack trace categorization definition.
-co, --csv-output
Output data in CSV format; default: false.
-f, --file
Path to stack dump file.
--flame
Exports flame graph to SVG format; default: not included.
--histo
Prints frame histogram; default: not included.
-nc, --named-class
Defines name stack trace. Use with other options.
classes
Use name=filter expression notation; default: no expression.
--print
Print traces from file; default: not included.
-rc, --rainbow
List of filters for rainbow coloring.
--ssa-help
Provides additional information about SSA options; default: not shown.
-si, --summary-info
Lists summaries.
--thread-info
Prints per thread information summary; default: false.
-tn, --thread-name
Filters thread name using Java RegEx syntax.
-tr, --time-range
Filters time range.
-tz, --time-zone
Time zone used for timestamps; default: UTC. Use --ssa-help for timezone notation.
--title
Inserts a flame graph title; default: Flame Graph.
-tf, --trace-filter
Applies filter to traces before processing. Use --ssa-help for more details about filter notation.
-tt, --trace-trim
Positional filter trim frames to process. Use --ssa-help for more details about trace filters.
--width
Flame graph width in pixels; default: 1200.

ttop

Displays top threads from JVM process.

-f, --filter
Wild card expression to filter threads by name.
-o, --order
Sort order. Value tags: CPU, USER, SYS, ALLOC, NAME; default: CPU.
-ri, --report-interval

Interval between CPU usage reports; default: 10000.

-si, --sampler-interval
Interval between polling MBeans; default: 500.
-n, --top-number
Number of threads to show; default: 20.