Partager via


Commandes DBA pour Azure Managed Instance pour Apache Cassandra

Azure Managed Instance pour Apache Cassandra est un service entièrement managé pour de purs clusters Apache Cassandra open source. Le service permet également aux configurations d’être remplacées, en fonction des besoins spécifiques de chaque charge de travail. Cette fonctionnalité permet une flexibilité et un contrôle maximals si nécessaire. Cet article explique comment exécuter des commandes DBA manuellement en cas de besoin.

Important

Les commandes Nodetool et sstable sont en préversion publique.

Cette fonctionnalité est fournie sans contrat de niveau de service. Nous vous déconseillons cette fonctionnalité pour les charges de travail de production. Pour plus d’informations, consultez Conditions d’Utilisation Supplémentaires relatives aux Évaluations Microsoft Azure.

Prise en charge des commandes DBA

Azure Managed Instance pour Apache Cassandra vous permet d’exécuter les commandes nodetool et sstable à l’aide d’Azure CLI pour l’administration courante. Toutes les commandes ne sont pas prises en charge et il existe certaines limitations. Pour connaître les commandes prises en charge, consultez les sections suivantes.

Avertissement

Certaines de ces commandes peuvent déstabiliser le cluster Cassandra. Vous devez uniquement utiliser ces commandes avec soin et après les tests dans des environnements hors production. Si possible, déployez d’abord une --dry-run option. Microsoft ne prend pas en charge les contrats SLA ou les problèmes liés à l’exécution de commandes qui modifient la configuration de base de données et/ou les tables par défaut.

Comment exécuter une commande nodetool

Azure Managed Instance pour Apache Cassandra fournit la commande Azure CLI suivante pour exécuter les commandes DBA :

az managed-cassandra cluster invoke-command --resource-group <rg> \
  --cluster-name <cluster> --host <ip of data node> --command-name nodetool \
  --arguments "<nodetool-subcommand>"="" "paramerter1"="" 

La sous-commande doit se trouver dans la --arguments section avec une valeur vide. Les indicateurs Nodetool sans valeur se présentent sous la forme : "<flag>"="". Si l’indicateur a une valeur, il est sous la forme : "<flag>"="value".

Voici un exemple d’exécution d’une commande nodetool sans indicateurs, dans ce cas la commande nodetool status :

az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> \
  --host <ip of data node> --command-name nodetool --arguments "status"="" 

Voici un exemple d’exécution d’une commande nodetool avec un indicateur, dans ce cas la commande nodetool compact :

az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> \
  --host <ip of data node> --command-name nodetool --arguments "compact"="" "-st"="65678794" 

Les deux renvoient un json sous la forme suivante :

{
    "commandErrorOutput": "",
    "commandOutput": "<result>",
    "exitCode": 0
}

Dans la plupart des cas, vous n’avez besoin que du commandOutput ou du exitCode. Voici un exemple pour obtenir uniquement le commandOutput :

az managed-cassandra cluster invoke-command --query "commandOutput" --resource-group $resourceGroupName \
  --cluster-name $clusterName --host $host --command-name nodetool --arguments getstreamthroughput=""

Comment exécuter une commande sstable

Les commandes sstable nécessitent un accès en lecture/écriture au répertoire de données Cassandra et à la base de données Cassandra à arrêter. Pour répondre à cette exigence, spécifiez ces deux paramètres : --cassandra-stop-start true et --readwrite true.

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
}

Comment exécuter d’autres commandes

Les commandes cassandra-reset-password permettent aux utilisateurs de changer leur mot de passe pour l’utilisateur Cassandra.

az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> \
  --host <ip of data node> --command-name cassandra-reset-password --arguments password="<password>"

Important

Le mot de passe est codé en URL (UTF-8) dans cette commande, ce qui signifie que les règles suivantes s’appliquent :

  • The alphanumeric characters "a" through "z", "A" through "Z" and "0" through "9" remain the same.
  • The special characters ".", "-", "*", and "_" remain the same.
  • The space character " " is converted into a plus sign "+".
  • All other characters are unsafe and are first converted into one or more bytes using some encoding scheme. Then each byte is represented by the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the byte.

Les commandes cassandra-reset-auth-replication permettent aux utilisateurs de changer leur schéma pour l’utilisateur Cassandra. Séparez les noms de centre de données par espace.

az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> \
  --host <ip of data node> --command-name cassandra-reset-auth-replication \
  --arguments password="<datacenters>"

Important

Les centres de données sont codés en URL (UTF-8) lorsqu’ils sont passés dans cette commande, ce qui signifie que les règles suivantes s’appliquent :

  • The alphanumeric characters "a" through "z", "A" through "Z" and "0" through "9" remain the same.
  • The special characters ".", "-", "*", and "_" remain the same.
  • The space character " " is converted into a plus sign "+".
  • All other characters are unsafe and are first converted into one or more bytes using some encoding scheme. Then each byte is represented by the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the byte.

La commande sstable-tree permet à un utilisateur d’afficher ses sstables.

az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> \
  --host <ip of data node> --command-name sstable-tree

La commande sstable-delete permet à un utilisateur de supprimer ses sstables créés avant un certain moment.

az managed-cassandra cluster invoke-command --resource-group <rg> --cluster-name <cluster> \
  --host <ip of data node> --command-name sstable-delete --arguments datetime="<YYYY-MM-DD hh:mm:ss>"

L’argument datetime doit être mis en forme comme indiqué dans l’exemple. Vous pouvez également ajouter --dry-run="" en tant qu’argument pour voir quels fichiers la commande supprime.

Liste des commandes sstable prises en charge

Pour plus d’informations sur chaque commande, consultez Outils SSTable.

  • sstableverify
  • sstablescrub
  • sstablemetadata
  • sstablelevelreset
  • sstableutil
  • sstablesplit
  • sstablerepairedset
  • sstableofflinerelevel
  • sstableexpiredblockers

Liste des commandes nodetool prises en charge

Pour plus d’informations sur chaque commande, consultez Utiliser Nodetool.

  • 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 - pour les arguments, utilisez "keyspace"="table indexname..."
  • refresh
  • refreshsizeestimates
  • reloadlocalschema
  • replaybatchlog
  • resetlocalschema
  • resumehandoff
  • ring
  • scrub
  • setcachecapacity - pour les arguments, utilisez "key-cache-capacity" = "<row-cache-capacity> <counter-cache-capacity>"
  • setcachekeystosave - pour les arguments, utilisez "key-cache-keys-to-save":"<row-cache-keys-to-save> <counter-cache-keys-to-save>"
  • setcompactionthreshold - pour les arguments, utilisez "<keyspace>"="<table> <minthreshold> <maxthreshold>
  • setcompactionthroughput
  • setconcurrentcompactors
  • sethintedhandoffthrottlekb
  • setinterdcstreamthroughput
  • setstreamthroughput
  • settimeout
  • settraceprobability
  • statusbackup
  • statusbinary
  • statusgossip
  • statushandoff
  • stop
  • tablehistograms
  • tablestats
  • toppartitions
  • tpstats
  • truncatehints
  • verify
  • version
  • viewbuildstatus

Étapes suivantes