Cassandra .csv导入错误:批量太大

时间:2016-04-14 08:54:01

标签: csv import cassandra copy

我正在尝试通过copy命令将.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;

我认为导入cassandra的299行并不算太多,或者我错了?

2 个答案:

答案 0 :(得分:5)

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

此批量大小在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。

有关COPY选项的更多信息 here

答案 1 :(得分:0)

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

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