1
私は、cassandraキースペースとテーブルのメタデータ情報をチェックするためのテストを書いています。 また、クラスタ内のどのノードが稼動しているか、どのノードが稼働停止しているかをチェックしたいと考えています。どうすればいい?すべてのcassandraノードの健全性をチェック
私は、cassandraキースペースとテーブルのメタデータ情報をチェックするためのテストを書いています。 また、クラスタ内のどのノードが稼動しているか、どのノードが稼働停止しているかをチェックしたいと考えています。どうすればいい?すべてのcassandraノードの健全性をチェック
nodetoolユーティリティを使用すると、診断および運用情報にアクセスできます。
nodetool ring
あなたのリングとその状態にあるノードのリストが表示されます。
node.jsドライバから、情報を取得することもできます。 Clientにはhosts
という属性があります。各ホストにはisUp機能があります。 exampleは、メタデータを使用して表示します。
"use strict";
const cassandra = require('cassandra-driver');
const client = new cassandra.Client({ contactPoints: ['127.0.0.1'] });
client.connect()
.then(function() {
console.log('Connected to cluster with %d host(s): %j', client.hosts.length);
client.hosts.forEach(function (host) {
console.log('Host %s v%s on rack %s, dc %s, isUp: %s', host.address, host.cassandraVersion, host.rack, host.datacenter, host.isUp());
});
console.log('Shutting down');
return client.shutdown();
})
.catch(function (err) {
console.error('There was an error when connecting', err);
return client.shutdown();
});
私はmochaを使用してテストを作成する必要があります。 nodeodsにnodetoolなどのモジュールがありますか? –
'const {spawn} = require( 'child_process')のようなものです。 const ring = spawn( 'nodetool'、['ring']); '?そのコマンドラインユーティリティです。実際にはもう一つのメカニズムで上記の更新ができない –