Share via


Azure Managed Instance for Apache Cassandra の DBA コマンド

Azure Managed Instance for Apache Cassandra は、純粋なオープンソースの Apache Cassandra クラスター用のフル マネージド サービスです。 このサービスでは、各ワークロードの特定のニーズに応じて構成をオーバーライドすることもできます。これにより、必要に応じて最大限の柔軟性と制御が可能になります。 この記事では、必要に応じて DBA コマンドを手動で実行する方法について説明します。

重要

nodetool コマンドと sstable コマンドは、パブリック プレビュー段階です。 この機能はサービス レベル アグリーメントなしで提供されています。運用環境のワークロードに使用することはお勧めできません。 詳しくは、Microsoft Azure プレビューの追加使用条件に関するページをご覧ください。

DBA コマンドのサポート

Azure Managed Instance for Apache Cassandra では、DBA を定期的に管理するために、Azure CLI を介して nodetool コマンドと sstable コマンドを実行できます。 すべてのコマンドがサポートされているのではなく、いくつかの制限があります。 サポートされているコマンドについては、以下のセクションを参照してください。

警告

これらのコマンドの中には Cassandra クラスターを不安定にするものがあるため、非運用環境でテストした後にのみ慎重に実行する必要があります。 可能であれば、最初に --dry-run オプションをデプロイしてください。 Microsoft は、既定のデータベース構成やテーブルを変更するコマンドの実行に関する問題について、いかなる SLA やサポートも提供することはできません。

nodetool コマンドを実行する方法

Azure Managed Instance for Apache Cassandra には、DBA コマンドを実行するための次の Azure CLI コマンドが用意されています。

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

特定のサブコマンドは、--arguments セクションに内に空の値を使用して含める必要があります。 値のない Nodetool フラグは、"<flag>"="" の形式です。 フラグに値がある場合は、"<flag>"="value" の形式になります。

次に、フラグを指定せずに nodetool コマンドを実行する例を示します。この場合、nodetool status コマンドは次のようになります。

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

次に、フラグを指定して nodetool コマンドを実行する例を示します。この場合、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" 

どちらも次の形式の JSON を返します。

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

ほとんどの場合、commandOutput または exitCode のみ必要になる可能性があります。 commandOutput のみ取得する例をこちらに示します。

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

sstable コマンドを実行する方法

sstable コマンドを使用する際は、Cassandra データ ディレクトリの読み取り/書き込みアクセスと Cassandra データベースを停止する必要があります。 これに対応するため、2 つの追加パラメーター --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
    }

他のコマンドを実行する方法

cassandra-reset-password コマンドを使用すると、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>"

重要

パスワードは、このコマンドに渡されるときに URL でエンコードされます (UTF-8)。つまり、次の規則が適用されます。

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

cassandra-reset-auth-replication コマンドを使用すると、Cassandra ユーザーのスキーマを変更できます。 データセンター名をスペースで区切ります。

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

重要

データセンターは、このコマンドに渡されるときに URL でエンコードされます (UTF-8)。つまり、次の規則が適用されます。

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

sstable-tree コマンドを使用すると、自分の sstable を表示できます。

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

sstable-delete コマンドを使用すると、特定の時刻より前に作成された sstable を削除できます。

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

Datetime 引数は、上記のように書式設定する必要があります。 また、引数として --dry-run="" を追加することで、削除されるファイルを確認することもできます。

サポートされている sstable コマンドの一覧

各コマンドの詳細については、https://cassandra.apache.org/doc/latest/cassandra/tools/sstable/index.html を参照してください。

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

サポートされている nodetool コマンドの一覧

各コマンドの詳細については、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 - 引数の場合は "keyspace"="table indexname..." を使用
  • refresh
  • refreshsizeestimates
  • reloadlocalschema
  • replaybatchlog
  • resetlocalschema
  • resumehandoff
  • ring
  • scrub
  • setcachecapacity - 引数の場合は "key-cache-capacity" = "<row-cache-capacity> <counter-cache-capacity>" を使用
  • setcachekeystosave - 引数の場合は "key-cache-keys-to-save":"<row-cache-keys-to-save> <counter-cache-keys-to-save>" を使用
  • setcompactionthreshold - 引数の場合は "<keyspace>"="<table> <minthreshold> <maxthreshold> を使用
  • setcompactionthroughput
  • setconcurrentcompactors
  • sethintedhandoffthrottlekb
  • setinterdcstreamthroughput
  • setstreamthroughput
  • settimeout
  • settraceprobability
  • statusbackup
  • statusbinary
  • statusgossip
  • statushandoff
  • stop
  • tablehistograms
  • tablestats
  • toppartitions
  • tpstats
  • truncatehints
  • verify
  • version
  • viewbuildstatus

次のステップ