【问题标题】:Can't trace hinted handoff in Cassandra无法追踪 Cassandra 中的提示切换
【发布时间】:2017-05-27 11:31:30
【问题描述】:

我正在尝试使用 Docker 中的 Cassandra 集群来模拟提示切换。

提示切换已激活:

root@2f5aa8d649e2:/# nodetool statushandoff
Hinted handoff is running

keyspace 的复制因子为 3:

cqlsh> DESCRIBE  KEYSPACE imdb;
CREATE KEYSPACE imdb WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '2', 'dc2': '1'}  AND durable_writes = true;

然后我关闭一个节点,打开跟踪并插入一个新行:

cqlsh:imdb> insert into movies_by_actor (actor, movie_id, character, movie_title, salary) values ('TomHanks', uuid(), 'Character', 'Title', 1000);

Tracing session: e4a2cc20-42ce-11e7-bd49-cf534e0135c6

 activity                                                                                                                                                                     | timestamp                  | source     | source_elapsed | client
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------+------------+----------------+-----------
                                                                                                                                                           Execute CQL3 query | 2017-05-27 11:23:22.466000 | 172.13.0.2 |              0 | 127.0.0.1
 Parsing insert into movies_by_actor (actor, movie_id, character, movie_title, salary) values ('TomHanks', uuid(), 'Character', 'Title', 1000); [Native-Transport-Requests-1] | 2017-05-27 11:23:22.467000 | 172.13.0.2 |            364 | 127.0.0.1
                                                                                                                            Preparing statement [Native-Transport-Requests-1] | 2017-05-27 11:23:22.467000 | 172.13.0.2 |            727 | 127.0.0.1
                                                                                                              Determining replicas for mutation [Native-Transport-Requests-1] | 2017-05-27 11:23:22.468000 | 172.13.0.2 |           1354 | 127.0.0.1
                                                                                        Sending MUTATION message to /172.13.0.3 [MessagingService-Outgoing-/172.13.0.3-Small] | 2017-05-27 11:23:22.468000 | 172.13.0.2 |           1722 | 127.0.0.1
                                                                                        Sending MUTATION message to /172.13.0.6 [MessagingService-Outgoing-/172.13.0.6-Small] | 2017-05-27 11:23:22.468000 | 172.13.0.2 |           1722 | 127.0.0.1
                                                                                           MUTATION message received from /172.13.0.2 [MessagingService-Incoming-/172.13.0.2] | 2017-05-27 11:23:22.469000 | 172.13.0.3 |             30 | 127.0.0.1
                                                                                           MUTATION message received from /172.13.0.2 [MessagingService-Incoming-/172.13.0.2] | 2017-05-27 11:23:22.469000 | 172.13.0.6 |             35 | 127.0.0.1
                                                                                                                                     Appending to commitlog [MutationStage-1] | 2017-05-27 11:23:22.469000 | 172.13.0.3 |            294 | 127.0.0.1
                                                                                                                                     Appending to commitlog [MutationStage-1] | 2017-05-27 11:23:22.469000 | 172.13.0.6 |            292 | 127.0.0.1
                                                                                                                         Adding to movies_by_actor memtable [MutationStage-1] | 2017-05-27 11:23:22.469000 | 172.13.0.6 |            486 | 127.0.0.1
                                                                                                                          Enqueuing response to /172.13.0.2 [MutationStage-1] | 2017-05-27 11:23:22.469000 | 172.13.0.6 |            660 | 127.0.0.1
                                                                                   REQUEST_RESPONSE message received from /172.13.0.3 [MessagingService-Incoming-/172.13.0.3] | 2017-05-27 11:23:22.470000 | 172.13.0.2 |           3659 | 127.0.0.1
                                                                                                                Processing response from /172.13.0.3 [RequestResponseStage-2] | 2017-05-27 11:23:22.470000 | 172.13.0.2 |           3820 | 127.0.0.1
                                                                                Sending REQUEST_RESPONSE message to /172.13.0.2 [MessagingService-Outgoing-/172.13.0.2-Small] | 2017-05-27 11:23:22.472000 | 172.13.0.6 |           3533 | 127.0.0.1
                                                                                   REQUEST_RESPONSE message received from /172.13.0.6 [MessagingService-Incoming-/172.13.0.6] | 2017-05-27 11:23:22.473000 | 172.13.0.2 |             34 | 127.0.0.1
                                                                                                                Processing response from /172.13.0.6 [RequestResponseStage-3] | 2017-05-27 11:23:22.473000 | 172.13.0.2 |            523 | 127.0.0.1
                                                                                                                                                             Request complete | 2017-05-27 11:23:22.469919 | 172.13.0.2 |           3919 | 127.0.0.1

从日志中可以看出,协调节点172.13.0.2 处理请求并联系节点172.13.0.3172.13.0.6。我希望节点172.13.0.2 保存提示的切换,因为第三个节点不可用。但是当我检查system.hints 表时,它是空的:

cqlsh:imdb> select * from system.hints;

 target_id | hint_id | message_version | mutation
-----------+---------+-----------------+----------

(0 rows)

一致性级别设置为默认ONE。有人可以解释提示的切换存储在哪里吗?

【问题讨论】:

    标签: cassandra


    【解决方案1】:

    最新版本的 cassandra 不在 system.hints 表中存储提示。

    提示存储在 cassandra 3.0 的平面文件中。如果使用大于 3.0 的 cassandra 版本,则必须查看在 cassandra.yaml 中配置的提示目录

    # Directory where Cassandra should store hints. 
    # If not set, the default directory is $CASSANDRA_HOME/data/hints. 
    hints_directory: "C:/Program Files/DataStax-DDC/data/hints" 
    # How often hints should be flushed from the internal buffers to disk. 
    # Will *not* trigger fsync. 
    hints_flush_period_in_ms: 10000 
    

    检查cassandra.yaml 中的上述 2 个值并在其中寻找提示。

    Hinted Handoff in cassandra 3.0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-05
      • 1970-01-01
      • 2011-11-05
      • 2017-10-30
      • 1970-01-01
      • 1970-01-01
      • 2013-01-05
      • 2020-02-05
      相关资源
      最近更新 更多