次の方法で共有


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 データベースを停止する必要があります。 この要件に対応するには、 --cassandra-stop-start true--readwrite trueの 2 つのパラメーターを指定します。

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 コマンドの一覧

各コマンドの詳細については、「 SSTable ツール」を参照してください。

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

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

各コマンドの詳細については、「 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 - 引数の場合は "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

次のステップ