Node.js 正在检查所有cassandra节点的运行状况
我正在编写测试来检查cassandra键空间和表的元数据信息。Node.js 正在检查所有cassandra节点的运行状况,node.js,cassandra,cassandra-node-driver,Node.js,Cassandra,Cassandra Node Driver,我正在编写测试来检查cassandra键空间和表的元数据信息。 我还想检查集群中哪个节点是向上的,哪个节点是向下的。如何操作?nodetool实用程序允许您访问诊断和操作信息 nodetool环 将为您提供环中节点及其状态的列表 从node.js驱动程序中,您还可以获得信息。具有hosts属性。每个主机都有一个可以使用的功能。显示了使用元数据的示例: "use strict"; const cassandra = require('cassandra-driver'); const clien
我还想检查集群中哪个节点是向上的,哪个节点是向下的。如何操作?nodetool实用程序允许您访问诊断和操作信息
nodetool环
将为您提供环中节点及其状态的列表
从node.js驱动程序中,您还可以获得信息。具有hosts
属性。每个主机都有一个可以使用的功能。显示了使用元数据的示例:
"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();
});
我必须用摩卡咖啡为它写一个测试。是否有nodetool模块或类似的nodejs模块?类似于
const{spawn}=require('child_process');const-ring=spawn('nodetool',['ring'])代码>?它是一个命令行实用程序。我也会用另一种机制更新上面的内容