Sdílet prostřednictvím


Příkazy DBA pro spravovanou instanci Azure pro Apache Cassandra

Azure Managed Instance for Apache Cassandra je plně spravovaná služba pro čistě opensourcové clustery Apache Cassandra. Služba také umožňuje přepsání konfigurací v závislosti na konkrétních potřebách jednotlivých úloh, což umožňuje maximální flexibilitu a kontrolu tam, kde je to potřeba. Tento článek popisuje, jak spustit příkazy DBA ručně, když nastane potřeba.

Důležité

Nodetool a příkazy sstable jsou ve verzi Public Preview. Tato funkce je poskytována bez smlouvy o úrovni služeb a nedoporučuje se pro produkční úlohy. Další informace najdete v dodatečných podmínkách použití pro verze Preview v Microsoft Azure.

Podpora příkazů DBA

Azure Managed Instance for Apache Cassandra umožňuje spouštět nodetool a sstable příkazy prostřednictvím Azure CLI pro rutinní správu DBA. Ne všechny příkazy jsou podporované a existují určitá omezení. Podporované příkazy najdete v následujících částech.

Upozorňující

Některé z těchto příkazů mohou cluster Cassandra stabilizovat a měly by být spouštěny opatrně a po otestování v neprodukčním prostředí. Pokud je to možné, --dry-run měla by se nejprve nasadit možnost. Microsoft nemůže nabídnout žádnou smlouvu SLA ani podporu problémů se spouštěním příkazů, které mění výchozí konfiguraci databáze nebo tabulky.

nodetool Spuštění příkazu

Azure Managed Instance for Apache Cassandra poskytuje následující příkaz Azure CLI pro spouštění příkazů 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"="" 

Konkrétní podpříkaz musí být v oddílu --arguments s prázdnou hodnotou. Nodetool příznaky bez hodnoty jsou ve formátu: "<flag>"="". Pokud má příznak hodnotu, je ve formuláři: "<flag>"="value".

Tady je příklad nodetool spuštění příkazu bez příznaků v tomto případě nodetool status :

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

Tady je příklad nodetool spuštění příkazu s příznakem v tomto případě 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" 

Oba vrátí json z následujícího formuláře:

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

Ve většině případů možná budete potřebovat jenom příkazOutput nebo exitCode. Tady je příklad pouze pro získání příkazuOutput:

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

sstable Spuštění příkazu

Příkazy sstable vyžadují přístup pro čtení a zápis k datovému adresáři Cassandra a k zastavení databáze Cassandra. Aby bylo možné tuto možnost přizpůsobit, je třeba zadat dva další parametry --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
    }

Jak spustit další příkazy

Příkaz cassandra-reset-password umožňuje uživateli změnit heslo pro uživatele 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>"

Důležité

Heslo je kódováno adresou URL (UTF-8), když je předáno do tohoto příkazu, což znamená, že platí následující pravidla:

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

Příkaz cassandra-reset-auth-replication umožňuje uživateli změnit schéma pro uživatele Cassandra. Názvy datacentra oddělte mezerou.

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

Důležité

Datacentra jsou při předání do tohoto příkazu kódovaná adresou URL (UTF-8), což znamená, že platí následující pravidla:

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

Příkaz sstable-tree umožňuje uživateli zobrazit jejich tabulky.

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

Příkaz sstable-delete umožňuje uživateli odstranit své sstables provedené před určitým časem.

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

Argument Datetime musí být formátovaný, jak je znázorněno výše. Můžete také přidat --dry-run="" jako argument, abyste viděli, které soubory budou odstraněny.

Seznam podporovaných sstable příkazů

Další informace o jednotlivých příkazech najdete v tématu https://cassandra.apache.org/doc/latest/cassandra/tools/sstable/index.html

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

Seznam podporovaných nodetool příkazů

Další informace o jednotlivých příkazech najdete v tématu 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 – pro použití argumentů "keyspace"="table indexname..."
  • refresh
  • refreshsizeestimates
  • reloadlocalschema
  • replaybatchlog
  • resetlocalschema
  • resumehandoff
  • ring
  • scrub
  • setcachecapacity – pro použití argumentů "key-cache-capacity" = "<row-cache-capacity> <counter-cache-capacity>"
  • setcachekeystosave – pro použití argumentů "key-cache-keys-to-save":"<row-cache-keys-to-save> <counter-cache-keys-to-save>"
  • setcompactionthreshold – pro použití argumentů "<keyspace>"="<table> <minthreshold> <maxthreshold>
  • setcompactionthroughput
  • setconcurrentcompactors
  • sethintedhandoffthrottlekb
  • setinterdcstreamthroughput
  • setstreamthroughput
  • settimeout
  • settraceprobability
  • statusbackup
  • statusbinary
  • statusgossip
  • statushandoff
  • stop
  • tablehistograms
  • tablestats
  • toppartitions
  • tpstats
  • truncatehints
  • verify
  • version
  • viewbuildstatus

Další kroky