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

问题描述 投票:9回答:2

我正在尝试通过复制命令将数据从.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 import cassandra copy
2个回答
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
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.