Polecenia bazy danych dla wystąpienia zarządzanego platformy Azure dla usługi Apache Cassandra

Azure Managed Instance for Apache Cassandra to w pełni zarządzana usługa dla czystych klastrów Apache Cassandra typu open source. Usługa umożliwia również zastępowanie konfiguracji w zależności od konkretnych potrzeb każdego obciążenia, co pozwala na maksymalną elastyczność i kontrolę w razie potrzeby. W tym artykule opisano sposób ręcznego uruchamiania poleceń administratora bazy danych w razie potrzeby.

Ważne

Narzędzia Nodetool i polecenia sstable są dostępne w publicznej wersji zapoznawczej. Ta funkcja jest udostępniana bez umowy dotyczącej poziomu usług i nie jest zalecana w przypadku obciążeń produkcyjnych. Aby uzyskać więcej informacji, zobacz Uzupełniające warunki korzystania z wersji zapoznawczych platformy Microsoft Azure.

Obsługa poleceń administratora bazy danych

Wystąpienie zarządzane platformy Azure dla usługi Apache Cassandra umożliwia uruchamianie nodetool poleceń i sstable za pośrednictwem interfejsu wiersza polecenia platformy Azure w celu rutynowego administrowania bazą danych. Nie wszystkie polecenia są obsługiwane i istnieją pewne ograniczenia. Aby uzyskać obsługiwane polecenia, zobacz poniższe sekcje.

Ostrzeżenie

Niektóre z tych poleceń mogą zdestabilizować klaster cassandra i powinny być uruchamiane dokładnie i po przetestowaniu w środowiskach nieprodukcyjnych. Jeśli jest to możliwe, --dry-run należy najpierw wdrożyć opcję. Firma Microsoft nie może zaoferować żadnej umowy SLA ani pomocy technicznej w przypadku problemów z uruchamianiem poleceń, które zmieniają domyślną konfigurację bazy danych i/lub tabele.

Jak uruchomić nodetool polecenie

Wystąpienie zarządzane platformy Azure dla usługi Apache Cassandra udostępnia następujące polecenie interfejsu wiersza polecenia platformy Azure do uruchamiania poleceń administratora bazy danych:

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

Konkretne podpolecenia muszą znajdować się w --arguments sekcji z pustą wartością. Nodetool flagi bez wartości mają postać: "<flag>"="". Jeśli flaga ma wartość, ma postać: "<flag>"="value".

Oto przykład uruchamiania nodetool polecenia bez flag, w tym przypadku nodetool status polecenia:

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

Oto przykład uruchamiania nodetool polecenia z flagą , w tym przypadku nodetool compact polecenia:

    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 będą zwracać kod json następującego formularza:

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

W większości przypadków może być potrzebne tylko polecenieOutput lub exitCode. Oto przykład pobierania tylko poleceniaOutput:

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

Jak uruchomić sstable polecenie

Polecenia sstable wymagają dostępu do odczytu/zapisu do katalogu danych Cassandra i bazy danych Cassandra do zatrzymania. Aby to uwzględnić, należy podać dwa dodatkowe 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 uruchomić inne polecenia

Polecenie cassandra-reset-password umożliwia użytkownikowi zmianę hasła użytkownika 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>"

Ważne

Hasło jest zakodowane w adresie URL (UTF-8) po przekazaniu do tego polecenia, co oznacza, że obowiązują następujące reguły:

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

Polecenie cassandra-reset-auth-replication umożliwia użytkownikowi zmianę schematu użytkownika cassandra. Rozdziel nazwy centrów danych spacją.

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

Ważne

Centra danych są kodowane adresami URL (UTF-8) po przekazaniu ich do tego polecenia, co oznacza, że obowiązują następujące reguły:

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

Polecenie sstable-tree umożliwia użytkownikowi wyświetlenie ich tabel.

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

Polecenie sstable-delete umożliwia użytkownikowi usunięcie tabel sstable wykonanych przed upływem określonego czasu.

    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 musi być sformatowany, jak pokazano powyżej. Możesz również dodać --dry-run="" jako argument, aby zobaczyć, które pliki zostaną usunięte.

Lista obsługiwanych sstable poleceń

Aby uzyskać więcej informacji na temat każdego polecenia, zobacz https://cassandra.apache.org/doc/latest/cassandra/tools/sstable/index.html

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

Lista obsługiwanych nodetool poleceń

Aby uzyskać więcej informacji na temat każdego polecenia, zobacz 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 - dla argumentów użyć "keyspace"="table indexname..."
  • refresh
  • refreshsizeestimates
  • reloadlocalschema
  • replaybatchlog
  • resetlocalschema
  • resumehandoff
  • ring
  • scrub
  • setcachecapacity - dla argumentów użyć "key-cache-capacity" = "<row-cache-capacity> <counter-cache-capacity>"
  • setcachekeystosave - dla argumentów użyć "key-cache-keys-to-save":"<row-cache-keys-to-save> <counter-cache-keys-to-save>"
  • setcompactionthreshold - dla argumentów użyć "<keyspace>"="<table> <minthreshold> <maxthreshold>
  • setcompactionthroughput
  • setconcurrentcompactors
  • sethintedhandoffthrottlekb
  • setinterdcstreamthroughput
  • setstreamthroughput
  • settimeout
  • settraceprobability
  • statusbackup
  • statusbinary
  • statusgossip
  • statushandoff
  • stop
  • tablehistograms
  • tablestats
  • toppartitions
  • tpstats
  • truncatehints
  • verify
  • version
  • viewbuildstatus

Następne kroki