cassandra copy导入数据时batch too large错误
执行COPY命令时,出现Batch too large错误:
1 | cqlsh:reis> COPY image FROM 'image.csv'; |
/var/log/cassandra/system.log文件中可见:
1 | ERROR \[SharedPool-Worker-1\] 2016-07-15 15:07:20,725 BatchStatement.java:267 - Batch of prepared statements for \[reis.image\] is of size 2732525, exceeding specified threshold of 614400 by 2118125. (see batch_size_fail_threshold_in_kb) |
batch就是批量执行DML语句. 因为我的image表中有大字段,用于存储图片,每个图片不超过500K,所以遭遇了batch too large错误.
/etc/cassandra/cassandra.yaml文件中,参数batch_size_fail_threshold_in_kb的默认值只有50,一条DML语句就超过了这个阈值.
所以将此参数设置为600
1 | batch_size_fail_threshold_in_kb: 600 |
然后将COPY命令的批操作限制为1:
1 | cqlsh:reis> COPY image FROM 'image.csv' WITH MAXBATCHSIZE = 1 and MINBATCHSIZE = 1; |
顺利的导入了所有数据.
===
[erq]