次の方法で共有


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

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

重要

コマンド nodetoolsstable はパブリック プレビュー中です。

この機能は、サービス レベル アグリーメント (SLA) なしで提供されます。 運用環境のワークロードでは、この機能はお勧めしません。 詳しくは、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) であるため、次の規則が適用されます。

  • 英数字azAからZ9までの0は変わりません。
  • 特殊文字 .-*_ は変わりません。
  • スペース文字はプラス記号 (+) に変換されます。
  • 他のすべての文字は安全ではなく、最初にエンコード スキームを使用して 1 つ以上のバイトに変換されます。 3 文字の文字列 %xy は各バイトを表します。ここで、 xy はバイトの 2 桁の 16 進数表現です。

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) されます。つまり、次の規則が適用されます。

  • 英数字azAからZ9までの0は変わりません。
  • 特殊文字 .-*_ は変わりません。
  • スペース文字はプラス記号 (+) に変換されます。
  • 他のすべての文字は安全ではなく、最初にエンコード スキームを使用して 1 つ以上のバイトに変換されます。 3 文字の文字列 %xy は各バイトを表します。ここで、 xy はバイトの 2 桁の 16 進数表現です。

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