Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cassandra 为什么创建一个表要花这么长时间?_Cassandra_Cql_Cassandra 3.0 - Fatal编程技术网

Cassandra 为什么创建一个表要花这么长时间?

Cassandra 为什么创建一个表要花这么长时间?,cassandra,cql,cassandra-3.0,Cassandra,Cql,Cassandra 3.0,我正在创建以下模式: CREATE TABLE stats_by_site_tracking_hourly ( d_tally text, -- 2016-02 d_date timestamp, -- 2016-02-01 13 site_id int, is_new_member int, -- 1/0 device text, -- desktop/tablet/mobile/unknown tracking_medium text,

我正在创建以下模式:

CREATE TABLE stats_by_site_tracking_hourly (
    d_tally text, -- 2016-02
    d_date timestamp, -- 2016-02-01 13
    site_id int,
    is_new_member int, -- 1/0
    device text, -- desktop/tablet/mobile/unknown
    tracking_medium text,
    tracking_source text,
    tracking_campaign text,
    tracking_term text,
    accepted counter,
    adjusted_accepted counter,
    rejected counter,
    adjusted_rejected counter,
    error counter,
    impressions_positive counter,
    adjusted_impressions_positive counter,
    impressions_negative counter,
    adjusted_impressions_negative counter,
    revenue counter,
    adjusted_revenue counter,
    reversals_rejected counter,
    reversals_revenue counter,
    PRIMARY KEY ((d_tally), site_id, d_date, is_new_member, device, tracking_medium, tracking_source, tracking_campaign, tracking_term)
);

当我运行该语句时,前几列的处理速度似乎很快,但当它移到计数器列时,每一列的处理速度都会越来越慢

我让这个声明运行了5分钟,但它仍然没有完成

有人能对这种行为提供一些见解吗


是创建表格时CQLSH的样子,截图时已经有20分钟左右没有进展了


我只是将CREATETABLE命令放在一行中,它立即起作用

CREATE TABLE stats_by_site_tracking_hourly ( d_tally text, d_date timestamp, site_id int, is_new_member int, device text, tracking_medium text, tracking_source text, tracking_campaign text, tracking_term text, accepted counter, adjusted_accepted counter, rejected counter, adjusted_rejected counter, error counter, impressions_positive counter, adjusted_impressions_positive counter, impressions_negative counter, adjusted_impressions_negative counter, revenue counter, adjusted_revenue counter, reversals_rejected counter, reversals_revenue counter, PRIMARY KEY ((d_tally), site_id, d_date, is_new_member, device, tracking_medium, tracking_source, tracking_campaign, tracking_term) );

我在几台计算机上都遇到了同样的问题,似乎这是cqlsh>交互式shell中的一个bug。如果从终端执行脚本,它将立即执行:

> cqlsh -f your_cql_script.cql <hostname>
>cqlsh-f您的_cql_script.cql
无论表格大小如何,此功能都会立即运行,并将为您节省大量时间。

我在此处提出了此错误:


这是由于模式中的选项卡造成的。CQLSH试图在每次到达选项卡时自动完成。

“前几列似乎处理得很快,但当它移动到计数器列时,每列的速度都越来越慢”-->您是如何衡量架构创建的进度的?当我将架构复制到CQLSH中时,它一次粘贴一行,我假设每列上的暂停是因为它正在添加列。这在很大程度上是一种假设,但是我想不出任何其他的延迟原因。我在问题中添加了cqlsh的屏幕截图。“当我将模式复制到cqlsh中时,它一次粘贴一行,我假设每列上的暂停是因为它正在添加列”-->可能是因为您的SSH连接很慢。cqlsh不会将CREATE TABLE查询发送到Cassandra,直到它拥有完整的语句,而不是逐行发送。SSH连接正常,并且在通过SSH或cqlsh运行任何命令时都会执行。我唯一一次遇到减速是在创建大表时。它只是一个3节点集群。从调查来看,当运行命令CQLSH时,似乎消耗了70%的RAM,并且在服务器上使用了107%的CPU,这减慢了一切。我将此作为一个bug发布到Datastax,结果是CQLSH解释了选项卡并试图自动完成+1.我没想到这件事还会发生!