【问题标题】:Error in cqlsh command line while querying查询时 cqlsh 命令行出错
【发布时间】:2015-05-26 03:12:13
【问题描述】:

我有一个三节点 Cassandra 集群运行得非常好。当我在集群的一个节点上进行select count(*) from usertracking; 查询时。我收到以下错误:

  errors={}, last_host=localhost
  Statement trace did not complete within 10 seconds

虽然,它在集群的其余两个节点上运行良好。谁能告诉我为什么我只在一个节点上收到此错误以及错误的原因是什么?

正如https://stackoverflow.com/questions/27766976/cassandra-cqlsh-query-fails-with-no-error 中给出的,我还在 cassandra.yaml 中增加了超时参数read_request_timeout_in_ms and range_request_timeout_in_ms。但这没有帮助。

KeySpace 定义:

CREATE KEYSPACE cw WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 3 };

表定义:

CREATE TABLE usertracking (
  cwc text,
  cur_visit_id text,
  cur_visit_datetime timestamp,
  cur_visit_last_ts bigint,
  prev_visit_datetime timestamp,
  prev_visit_last_ts bigint,
  tot_page_view bigint,
  tot_time_spent bigint,
  tot_visit_count bigint,
  PRIMARY KEY (cwc)
);

节点工具状态的输出:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address        Load       Tokens  Owns    Host ID                               Rack
UN  192.168.1.200  146.06 MB  1       ?       92c5bd4a-8f2b-4d7b-b420-6261a1bb8648  rack1
UN  192.168.1.201  138.53 MB  1       ?       817d331b-4cc0-4770-be6d-7896fc00e82f  rack1
UN  192.168.1.202  155.04 MB  1       ?       351731fb-c3ad-45e0-b2c8-bc1f3b1bf25d  rack1

nodetool tpstats的输出:

Pool Name                    Active   Pending      Completed   Blocked  All time blocked
CounterMutationStage              0         0              0         0                 0
ReadStage                         0         0             25         0                 0
RequestResponseStage              0         0         257103         0                 0
MutationStage                     0         0         593226         0                 0
ReadRepairStage                   0         0              0         0                 0
GossipStage                       0         0         612335         0                 0
CacheCleanupExecutor              0         0              0         0                 0
AntiEntropyStage                  0         0              0         0                 0
MigrationStage                    0         0              0         0                 0
ValidationExecutor                0         0              0         0                 0
CommitLogArchiver                 0         0              0         0                 0
MiscStage                         0         0              0         0                 0
MemtableFlushWriter               0         0             87         0                 0
MemtableReclaimMemory             0         0             87         0                 0
PendingRangeCalculator            0         0              3         0                 0
MemtablePostFlush                 0         0           2829         0                 0
CompactionExecutor                0         0            216         0                 0
InternalResponseStage             0         0              0         0                 0
HintedHandoff                     0         0              2         0                 0

Message type           Dropped
RANGE_SLICE                  0
READ_REPAIR                  0
PAGED_RANGE                  0
BINARY                       0
READ                         0
MUTATION                     0
_TRACE                       0
REQUEST_RESPONSE             0
COUNTER_MUTATION             0

【问题讨论】:

  • 这是一个症状,通过增加超时来修复它可能无法解决整体问题。你能分享nodetool statusnodetool tpstats的输出吗(后者应该在查询运行期间执行)。也看看表定义可能对我们有帮助。
  • @Lyuben 我已经更新了这个问题。如果有帮助请看一下

标签: cassandra cassandra-2.0 cqlsh cassandra-cli


【解决方案1】:

不确定这是否有帮助。我的开发环境中有一个非常相似的配置,并且在运行计数操作时遇到了 OperationTimedOut 错误。

和你一样,我最初尝试使用 cassandra.yaml 中的各种 TIMEOUT 变量,但这些似乎没有任何区别。

最终,被超过的超时实际上是cqlsh客户端本身。当我使用以下内容更新/创建 ~/.cassandra/cqlshrc 文件时,我能够运行计数而不会失败。

[connection]
client_timeout = 20

此示例将客户端超时设置为 20 秒。 以下文章中有一些关于 cqlshrc 文件的信息:CQL Configuration File

希望这会有所帮助,抱歉,如果我叫错了树。

【讨论】:

    猜你喜欢
    • 2020-01-13
    • 2021-02-28
    • 2017-07-03
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 2016-12-01
    • 1970-01-01
    • 2022-01-27
    相关资源
    最近更新 更多