DBA commands for Azure Managed Instance for Apache Cassandra
Azure Managed Instance for Apache Cassandra provides automated deployment, scaling, and management operations for open-source Apache Cassandra data centers. The automation in the service should be sufficient for many use cases. However, this article describes how to run DBA commands manually when the need arises.
Important
Nodetool and sstable commands are in public preview. This feature is provided without a service level agreement, and it's not recommended for production workloads. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
DBA command support
Azure Managed Instance for Apache Cassandra allows you to run nodetool
and sstable
commands via Azure CLI, for routine DBA administration. Not all commands are supported and there are some limitations. For supported commands, see the sections below.
Warning
Some of these commands can destabilize the cassandra cluster and should only be run carefully and after being tested in non-production environments. Where possible a --dry-run
option should be deployed first. Microsoft cannot offer any SLA or support on issues with running commands which alter the default database configuration and/or tables.
How to run a nodetool
command
Azure Managed Instance for Apache Cassandra provides the following Azure CLI command to run DBA commands:
az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> --host <ip of data node> --command-name nodetool --arguments "<nodetool-subcommand>"="" "paramerter1"=""
The particular subcommand needs to be in the --arguments
section with an empty value. Nodetool
flags without a value are in the form: "<flag>"=""
. If the flag has a value, it is in the form: "<flag>"="value"
.
Here's an example of how to run a nodetool
command without flags, in this case the nodetool status
command:
az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> --host <ip of data node> --command-name nodetool --arguments "status"=""
Here's an example of how to run a nodetool
command with a flag, in this case the nodetool compact
command:
az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> --host <ip of data node> --command-name nodetool --arguments "compact"="" "-st"="65678794"
Both will return a json of the following form:
{
"commandErrorOutput": "",
"commandOutput": "<result>",
"exitCode": 0
}
In most cases you might only need the commandOutput or the exitCode. Here is an example for only getting the commandOutput:
az managed-cassandra cluster invoke-command --query "commandOutput" --resource-group $resourceGroupName --cluster-name $clusterName --host $host --command-name nodetool --arguments getstreamthroughput=""
How to run an sstable
command
The sstable
commands require read/write access to the cassandra data directory and the cassandra database to be stopped. To accommodate this, two extra parameters --cassandra-stop-start true
and --readwrite true
need to be given:
az managed-cassandra cluster invoke-command --resource-group <test-rg> --cluster-name <test-cluster> --host <ip> --cassandra-stop-start true --readwrite true --command-name sstableutil --arguments "system"="peers"
{
"commandErrorOutput": "",
"commandOutput": "Listing files...\n/var/lib/cassandra/data/system/peers-37f71aca7dc2383ba70672528af04d4f/me-1-big-CompressionInfo.db\n/var/lib/cassandra/data/system/peers-37f71aca7dc2383ba70672528af04d4f/me-1-big-Data.db\n/var/lib/cassandra/data/system/peers-37f71aca7dc2383ba70672528af04d4f/me-1-big-Digest.crc32\n/var/lib/cassandra/data/system/peers-37f71aca7dc2383ba70672528af04d4f/me-1-big-Filter.db\n/var/lib/cassandra/data/system/peers-37f71aca7dc2383ba70672528af04d4f/me-1-big-Index.db\n/var/lib/cassandra/data/system/peers-37f71aca7dc2383ba70672528af04d4f/me-1-big-Statistics.db\n/var/lib/cassandra/data/system/peers-37f71aca7dc2383ba70672528af04d4f/me-1-big-Summary.db\n/var/lib/cassandra/data/system/peers-37f71aca7dc2383ba70672528af04d4f/me-1-big-TOC.txt\n",
"exitCode": 0
}
List of supported sstable
commands
For more information on each command, see https://cassandra.apache.org/doc/latest/cassandra/tools/sstable/index.html
sstableverify
sstablescrub
sstablemetadata
sstablelevelreset
sstableutil
sstablesplit
sstablerepairedset
sstableofflinerelevel
sstableexpiredblockers
List of supported nodetool
commands
For more information on each command, see https://cassandra.apache.org/doc/latest/cassandra/tools/nodetool/nodetool.html
status
cleanup
clearsnapshot
compact
compactionhistory
compactionstats
describecluster
describering
disableautocompaction
disablehandoff
disablehintsfordc
drain
enableautocompaction
enablehandoff
enablehintsfordc
failuredetector
flush
garbagecollect
gcstats
getcompactionthreshold
getcompactionthroughput
getconcurrentcompactors
getendpoints
getinterdcstreamthroughput
getlogginglevels
getsstables
getstreamthroughput
gettimeout
gettraceprobability
gossipinfo
info
invalidatecountercache
invalidatekeycache
invalidaterowcache
listsnapshots
netstats
pausehandoff
proxyhistograms
rangekeysample
rebuild
rebuild_index
- for arguments use"keyspace"="table indexname..."
refresh
refreshsizeestimates
reloadlocalschema
replaybatchlog
resetlocalschema
resumehandoff
ring
scrub
setcachecapacity
- for arguments use"key-cache-capacity" = "<row-cache-capacity> <counter-cache-capacity>"
setcachekeystosave
- for arguments use"key-cache-keys-to-save":"<row-cache-keys-to-save> <counter-cache-keys-to-save>"
setcompactionthreshold
- for arguments use"<keyspace>"="<table> <minthreshold> <maxthreshold>
setcompactionthroughput
setconcurrentcompactors
sethintedhandoffthrottlekb
setinterdcstreamthroughput
setstreamthroughput
settimeout
settraceprobability
statusbackup
statusbinary
statusgossip
statushandoff
stop
tablehistograms
tablestats
toppartitions
tpstats
truncatehints
verify
version
viewbuildstatus
Next steps
Feedback
Submit and view feedback for