【问题标题】:Cassandra .csv import error:batch too largeCassandra .csv 导入错误:批量太大
【发布时间】:2016-08-05 17:08:52
【问题描述】:

我正在尝试通过复制命令将数据从 .csv 文件导入 Cassandra 3.2.1。文件中只有 299 行和 14 列。我得到错误:

无法导入 299 行:InvalidRequest - code=2200 [Invalid query] message="Batch too large"

我使用以下复制命令并尝试增加批量大小:

copy table (Col1,Col2,...)from 'file.csv' with delimiter =';' and header = true and MAXBATCHSIZE = 5000;

我认为 299 行导入到 cassandra 并不算多,还是我错了?

【问题讨论】:

  • 尝试逐步增加.csv中的行数。 200 行可以正常工作,300 行不行。

标签: csv import cassandra copy


【解决方案1】:

您遇到的错误是服务器端错误消息,指出您的批量插入的 大小(以字节数计)太大。

这个批量大小在cassandra.yaml 文件中定义:

# Log WARN on any batch size exceeding this value. 5kb per batch by default.
# Caution should be taken on increasing the size of this threshold as it can lead to node instability.
batch_size_warn_threshold_in_kb: 5

# Fail any batch exceeding this value. 50kb (10x warn threshold) by default.
batch_size_fail_threshold_in_kb: 50

如果您插入很多大列(按大小计),您可能会很快达到此阈值。尝试将MAXBATCHSIZE 减少到 200。

更多关于复制选项的信息here

【讨论】:

    【解决方案2】:

    添加 CHUNKSIZE 关键字为我解决了这个问题。

    例如 从 '/home/kiren/dumps/event_stats_user.csv' 复制 event_stats_user , CHUNKSIZE=1 ;

    【讨论】:

    • +1 这在不改变 cassandra.yaml/scylla.yaml 的情况下解决了我的问题。顺便说一句,我正在使用 ScyllaDB。
    • 这解决了问题+!
    猜你喜欢
    • 2019-12-21
    • 2017-05-10
    • 2014-02-03
    • 2021-08-20
    • 1970-01-01
    • 2015-07-11
    • 2017-05-24
    • 2016-07-26
    • 2017-05-30
    相关资源
    最近更新 更多