Share via


Comandi DBA per Azure Istanza gestita per Apache Cassandra

Azure Istanza gestita per Apache Cassandra è un servizio completamente gestito per cluster Apache Cassandra open source puri. Il servizio consente anche di eseguire l'override delle configurazioni, a seconda delle esigenze specifiche di ogni carico di lavoro, consentendo la massima flessibilità e controllo dove necessario. Questo articolo descrive come eseguire manualmente i comandi DBA in caso di necessità.

Importante

I comandi Nodetool e sstable sono disponibili in anteprima pubblica. Questa funzionalità viene fornita senza un contratto di servizio e non è consigliata per i carichi di lavoro di produzione. Per altre informazioni, vedere le Condizioni supplementari per l'uso delle anteprime di Microsoft Azure.

Supporto dei comandi DBA

Azure Istanza gestita per Apache Cassandra consente di eseguire nodetool comandi e sstable tramite l'interfaccia della riga di comando di Azure per l'amministrazione di routine dell'amministratore di database. Non tutti i comandi sono supportati e esistono alcune limitazioni. Per i comandi supportati, vedere le sezioni seguenti.

Avviso

Alcuni di questi comandi possono destabilizzare il cluster cassandra e devono essere eseguiti con attenzione e dopo essere stati testati in ambienti non di produzione. Se possibile, è necessario distribuire prima un'opzione --dry-run . Microsoft non può offrire alcun contratto di servizio o supporto per problemi relativi all'esecuzione di comandi che modificano la configurazione e/o le tabelle predefinite del database.

Come eseguire un nodetool comando

Azure Istanza gestita per Apache Cassandra fornisce il comando dell'interfaccia della riga di comando di Azure seguente per eseguire i comandi 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"="" 

Il sottocomando specifico deve trovarsi nella --arguments sezione con un valore vuoto. Nodetool i flag senza un valore sono nel formato : "<flag>"="". Se il flag ha un valore, si trova nel formato : "<flag>"="value".

Ecco un esempio di come eseguire un nodetool comando senza flag, in questo caso il nodetool status comando :

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

Ecco un esempio di come eseguire un nodetool comando con un flag, in questo caso il nodetool compact comando :

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

Entrambi restituiranno un json del formato seguente:

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

Nella maggior parte dei casi potrebbe essere necessario solo il comandoOutput o exitCode. Di seguito è riportato un esempio per ottenere solo il comandoOutput:

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

Come eseguire un sstable comando

I sstable comandi richiedono l'accesso in lettura/scrittura alla directory dei dati Cassandra e al database Cassandra da arrestare. Per soddisfare questo problema, è necessario specificare due parametri aggiuntivi --cassandra-stop-start true--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
    }

Come eseguire altri comandi

Il cassandra-reset-password comando consente a un utente di modificare la password per l'utente 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>"

Importante

La password è con codifica URL (UTF-8) quando viene passata a questo comando, ovvero si applicano le regole seguenti:

  • 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.

Il cassandra-reset-auth-replication comando consente a un utente di modificare lo schema per l'utente Cassandra. Separare i nomi dei data center in base allo spazio.

    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>"

Importante

I data center sono codificati con URL (UTF-8) quando vengono passati a questo comando, ovvero si applicano le regole seguenti:

  • 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.

Il sstable-tree comando consente a un utente di visualizzare gli instabili.

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

Il sstable-delete comando consente a un utente di eliminare gli instabili eseguiti prima di un determinato momento.

    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'argomento Datetime deve essere formattato come illustrato in precedenza. È anche possibile aggiungere --dry-run="" come argomento per vedere quali file verranno eliminati.

Elenco dei comandi supportati sstable

Per altre informazioni su ogni comando, vedere https://cassandra.apache.org/doc/latest/cassandra/tools/sstable/index.html

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

Elenco dei comandi supportati nodetool

Per altre informazioni su ogni comando, vedere 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 - per gli argomenti usare "keyspace"="table indexname..."
  • refresh
  • refreshsizeestimates
  • reloadlocalschema
  • replaybatchlog
  • resetlocalschema
  • resumehandoff
  • ring
  • scrub
  • setcachecapacity - per gli argomenti usare "key-cache-capacity" = "<row-cache-capacity> <counter-cache-capacity>"
  • setcachekeystosave - per gli argomenti usare "key-cache-keys-to-save":"<row-cache-keys-to-save> <counter-cache-keys-to-save>"
  • setcompactionthreshold - per gli argomenti usare "<keyspace>"="<table> <minthreshold> <maxthreshold>
  • setcompactionthroughput
  • setconcurrentcompactors
  • sethintedhandoffthrottlekb
  • setinterdcstreamthroughput
  • setstreamthroughput
  • settimeout
  • settraceprobability
  • statusbackup
  • statusbinary
  • statusgossip
  • statushandoff
  • stop
  • tablehistograms
  • tablestats
  • toppartitions
  • tpstats
  • truncatehints
  • verify
  • version
  • viewbuildstatus

Passaggi successivi