【问题标题】:Is there any other way to get a cassandra hostid other than using nodetool status?除了使用 nodetool 状态之外,还有其他方法可以获取 cassandra hostid 吗?
【发布时间】:2018-04-21 21:33:23
【问题描述】:

我可以使用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 进入的节点)获取 Host ID,而无需从 status 输出中解析它?

我正在使用 datastax 企业...以防万一

【问题讨论】:

    标签: datastax-enterprise uniqueidentifier cassandra-3.0 nodetool


    【解决方案1】:

    每个节点都将有关自身的信息保存在 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 表中保存了相同类型的信息,但这仅适用于除自身之外的所有其他节点。这就是为什么我认为对每个节点进行一次查询会更容易。

    【讨论】:

    • 太棒了..谢谢。不直观地检查那张表,我觉得有点愚蠢。
    猜你喜欢
    • 2019-09-14
    • 1970-01-01
    • 2018-03-01
    • 2015-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-18
    相关资源
    最近更新 更多