cassandra - 除了使用 nodetool status 之外,还有其他方法获取 cassandra hostid 吗?

标签 cassandra datastax-enterprise uniqueidentifier cassandra-3.0 nodetool

我可以使用 nodetool status 列出完整的集群信息,它会输出类似这样的信息。

Datacenter: bi
==============
Status=Up/Down|/ State=Normal/Leaving/Joining/Moving
--  Address       Load       Tokens       Owns    Host ID                               
Rack
UN  10.132.2.93   19.88 GiB  32           ?       g94eee1f-1ge1-45c3-8cfgb-643719456c4fd  us-east-1a
UN  10.221.1.140  11.64 GiB  32           ?       b38f2fb2-fcf2-4567-b0cc-1548f63f0f24  us-east-1c

有没有一种更简单的方法可以从当前节点(终端通过 ssh 连接到的节点)获取主机 ID,而无需从状态中解析它输出?

我正在使用 datastax enterprise...以防有帮助

最佳答案

每个节点都在 system.local 表中保存有关自身的信息。您可以使用 cqlsh 来获取此信息。

cqlsh 10.132.2.93 -e 'SELECT host_id FROM system.local;'
cqlsh 10.221.1.140 -e 'SELECT host_id FROM system.local;'

它还在 system.peers 表中保存相同类型的信息,但这仅适用于除自身之外的所有其他节点。这就是为什么我认为对每个节点执行一次查询会更容易。

关于cassandra - 除了使用 nodetool status 之外,还有其他方法获取 cassandra hostid 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47192548/

相关文章:

datastax - Datastax DSE 5.1 搜索是否支持 facet.pivot 中使用的 Solr 本地参数

Cassandra启动

Cassandra NoHostAvailableException

sorting - 使用 RandomPartioner 和 Hector 作为客户端时如何从 cassandra 中获取已排序的行?

bash - Docker 上的 DataStax Enterprise : fails to start due to/hadoop/conf directory not being writable

cassandra - 将 cassandra 作为服务启动不适用于 2.0.5,sudo cassandra -f 有效

Cassandra "Unexpected error deserializing mutation"错误

java - Thread.getId() 全局唯一性问题

ios - 即使在清除应用程序数据后也能识别设备的唯一 ID

c# - 进一步削减uuid以制作短字符串