Skip to content

Commit cb7b4a3

Browse files
authored
Merge pull request #190272 from TheovanKraay/dba-commands
dba commands
2 parents 7d7f6ea + 18cec80 commit cb7b4a3

File tree

3 files changed

+179
-1
lines changed

3 files changed

+179
-1
lines changed

articles/managed-instance-apache-cassandra/TOC.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
- name: Visualize metrics in Prometheus with Grafana
5353
href: visualize-prometheus-grafana.md
5454
- name: Enable materialized views
55-
href: materialized-views.md
55+
href: materialized-views.md
56+
- name: Nodetool commands
57+
href: dba-commands.md
5658
- name: Reference
5759
items:
5860
- name: REST API
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
---
2+
title: How to run DBA commands for Azure Managed Instance for Apache Cassandra
3+
description: Learn how to run DBA commands
4+
author: TheovanKraay
5+
ms.service: managed-instance-apache-cassandra
6+
ms.topic: how-to
7+
ms.date: 03/02/2022
8+
ms.author: thvankra
9+
---
10+
11+
# DBA commands for Azure Managed Instance for Apache Cassandra
12+
13+
Azure Managed Instance for Apache Cassandra provides automated deployment, scaling, and [management operations](management-operations.md) 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.
14+
15+
> [!IMPORTANT]
16+
> Nodetool commands are in public preview.
17+
> This feature is provided without a service level agreement, and it's not recommended for production workloads.
18+
> For more information, see [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
19+
20+
<!-- ## DBA command support
21+
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. -->
22+
23+
## DBA command support
24+
Azure Managed Instance for Apache Cassandra allows you to run `nodetool` 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.
25+
26+
>[!WARNING]
27+
> 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.
28+
29+
30+
31+
## How to run a nodetool command
32+
Azure Managed Instance for Apache Cassandra provides the following Azure CLI command to run DBA commands:
33+
34+
```azurecli-interactive
35+
az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> --host <ip of data node> --command-name nodetool --arguments "<nodetool-subcommand>"="" "paramerter1"=""
36+
```
37+
38+
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"`.
39+
40+
Here's an example of how to run a `nodetool` command without flags, in this case the `nodetool status` command:
41+
42+
```azurecli-interactive
43+
az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> --host <ip of data node> --command-name nodetool --arguments "status"=""
44+
```
45+
46+
Here's an example of how to run a `nodetool` command with a flag, in this case the `nodetool compact` command:
47+
48+
```azurecli-interactive
49+
az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> --host <ip of data node> --command-name nodetool --arguments "compact"="" "-st"="65678794"
50+
```
51+
52+
Both will return a json of the following form:
53+
54+
```json
55+
{
56+
"commandErrorOutput": "",
57+
"commandOutput": "<result>",
58+
"exitCode": 0
59+
}
60+
```
61+
62+
<!-- ## How to run an sstable command
63+
64+
The `sstable` commands require read/write access to the cassandra data directory and the cassandra database to be stopped. To accomodate this, two additional parameters `--cassandra-stop-start true` and `--readwrite true` need to be given:
65+
66+
```azurecli-interactive
67+
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"
68+
```
69+
70+
```json
71+
{
72+
"commandErrorOutput": "",
73+
"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",
74+
"exitCode": 0
75+
}
76+
``` -->
77+
78+
<!-- ## List of supported sstable commands
79+
80+
For more information on each command, see https://cassandra.apache.org/doc/latest/cassandra/tools/sstable/index.html
81+
82+
* `sstableverify`
83+
* `sstablescrub`
84+
* `sstablemetadata`
85+
* `sstablelevelreset`
86+
* `sstableutil`
87+
* `sstablesplit`
88+
* `sstablerepairedset`
89+
* `sstableofflinerelevel`
90+
* `sstableexpiredblockers` -->
91+
92+
## List of supported nodetool commands
93+
94+
For more information on each command, see https://cassandra.apache.org/doc/latest/cassandra/tools/nodetool/nodetool.html
95+
96+
* `status`
97+
* `cleanup`
98+
* `clearsnapshot`
99+
* `compact`
100+
* `compactionhistory`
101+
* `compactionstats`
102+
* `describecluster`
103+
* `describering`
104+
* `disableautocompaction`
105+
* `disablehandoff`
106+
* `disablehintsfordc`
107+
* `drain`
108+
* `enableautocompaction`
109+
* `enablehandoff`
110+
* `enablehintsfordc`
111+
* `failuredetector`
112+
* `flush`
113+
* `garbagecollect`
114+
* `gcstats`
115+
* `getcompactionthreshold`
116+
* `getcompactionthroughput`
117+
* `getconcurrentcompactors`
118+
* `getendpoints`
119+
* `getinterdcstreamthroughput`
120+
* `getlogginglevels`
121+
* `getsstables`
122+
* `getstreamthroughput`
123+
* `gettimeout`
124+
* `gettraceprobability`
125+
* `gossipinfo`
126+
* `info`
127+
* `invalidatecountercache`
128+
* `invalidatekeycache`
129+
* `invalidaterowcache`
130+
* `listsnapshots`
131+
* `netstats`
132+
* `pausehandoff`
133+
* `proxyhistograms`
134+
* `rangekeysample`
135+
* `rebuild`
136+
* `rebuild_index` - for arguments use `"keyspace"="table indexname..."`
137+
* `refresh`
138+
* `refreshsizeestimates`
139+
* `reloadlocalschema`
140+
* `replaybatchlog`
141+
* `resetlocalschema`
142+
* `resumehandoff`
143+
* `ring`
144+
* `scrub`
145+
* `setcachecapacity` - for arguments use `"key-cache-capacity" = "<row-cache-capacity> <counter-cache-capacity>"`
146+
* `setcachekeystosave` - for arguments use `"key-cache-keys-to-save":"<row-cache-keys-to-save> <counter-cache-keys-to-save>"`
147+
* `setcompactionthreshold` - for arguments use `"<keyspace>"="<table> <minthreshold> <maxthreshold>`
148+
* `setcompactionthroughput`
149+
* `setconcurrentcompactors`
150+
* `sethintedhandoffthrottlekb`
151+
* `setinterdcstreamthroughput`
152+
* `setstreamthroughput`
153+
* `settimeout`
154+
* `settraceprobability`
155+
* `statusbackup`
156+
* `statusbinary`
157+
* `statusgossip`
158+
* `statushandoff`
159+
* `stop`
160+
* `tablehistograms`
161+
* `tablestats`
162+
* `toppartitions`
163+
* `tpstats`
164+
* `truncatehints`
165+
* `verify`
166+
* `version`
167+
* `viewbuildstatus`
168+
169+
## Next steps
170+
171+
* [Create a managed instance cluster from the Azure portal](create-cluster-portal.md)
172+
* [Manage Azure Managed Instance for Apache Cassandra resources using Azure CLI](manage-resources-cli.md)
173+
* [Management operations in Azure Managed Instance for Apache Cassandra](management-operations.md)

articles/managed-instance-apache-cassandra/management-operations.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ Azure Managed Instance for Apache Cassandra provides an [SLA](https://azure.micr
5555
>
5656
> In the event that we investigate a support case and discover that the root cause of the issue is at the Apache Cassandra configuration level (and not any underlying platform level aspects we maintain), the case may be closed. Where possible, we will also provide recommendations and guidance on remediation. We therefore recommend you [enable metrics](visualize-prometheus-grafana.md) and/or become familiar with our [Azure monitor integration](monitor-clusters.md ) in order to prevent common application/configuration level issues in Apache Cassandra, such as the above.
5757
58+
>[!WARNING]
59+
> Azure Managed Instance for Apache Cassandra also let's you run `nodetool` and `sstable` commands for routine DBA administration - see article [here](dba-commands.md). 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.
60+
5861
## Backup and restore
5962

6063
Snapshot backups are enabled by default and taken every 4 hours with [Medusa](https://github.com/thelastpickle/cassandra-medusa). Backups are stored in an internal Azure Blob Storage account and are retained for up to 2 days (48 hours). There is no cost for backups. To restore from a backup, file a [support request](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/newsupportrequest) in the Azure portal.

0 commit comments

Comments
 (0)