【elasticsearch】问题解决:Remote responded with a chunk that was too large. Use a smaller batch size

一、前言

在使用reindex的方式来进行es索引跨集群迁移时,遇到的报错,这里整理并记录一下。


二、问题描述

es索引迁移命令:

curl -u admin:admin   -XPOST "http://10.1.36.14:9200/_reindex" -d '
{
  "source": {
    "remote": {
      "host": "http://10.11.36.142:29200",
      "username": "admin",
      "password": "admin"
    },
    "index": "sentiment_new_short_data_2020_06"
  },
  "dest": {
    "index": "sentiment_new_short_data_2020_06"
  }
}'

过了一段时间后报错,报错内容如下:

{
	"error": {
		"root_cause": [{
			"type": "illegal_argument_exception",
			"reason": "Remote responded with a chunk that was too large. Use a smaller batch size."
		}],
		"type": "illegal_argument_exception",
		"reason": "Remote responded with a chunk that was too large. Use a smaller batch size.",
		"caused_by": {
			"type": "content_too_long_exception",
			"reason": "entity content is too long [120409280] for the configured buffer limit [104857600]"
		}
	},
	"status": 400
}

三、解决方案:

方法一:

修改HTTP 请求正文的最大大小。默认为100M,(Static) Maximum size of an HTTP request body. Defaults to 100mb。

http.max_content_length

注意事项:静态设置只能在未启动或关闭的节点上使用 elasticsearch.yml。
必须在集群中的每个相关节点上设置静态设置。

方法二:

减少迁移时每批次的文档数量,默认为1000

{ "size": 800}

修改后:

curl -u admin:admin   -XPOST "http://10.1.36.14:9200/_reindex" -d '
{
  "source": {
    "remote": {
      "host": "http://10.11.36.142:29200",
      "username": "admin",
      "password": "admin"
    },
    "index": "sentiment_new_short_data_2020_06",
    "size": 800
  },
  "dest": {
    "index": "sentiment_new_short_data_2020_06"
  }
}'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据提供的引用内容,"org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception Data too large"错误是由于数据大小超过了Elasticsearch的限制引起的[^1]。具体来说,错误信息中提到了"circuit_breaking_exception",这是Elasticsearch中的一种机制,用于防止节点过载。当数据大小超过了限制时,Elasticsearch会触发断路器并抛出此异常。 为了解决这个问题,可以尝试以下方法: 1. 增加Elasticsearch的限制:可以通过修改Elasticsearch的配置文件来增加限制。具体来说,可以增加`indices.breaker.total.limit`和`indices.breaker.request.limit`的值,以适应更大的数据量。但是需要注意,增加限制可能会导致节点负载过高,因此需要根据实际情况进行调整。 2. 减少数据量:如果数据量超过了Elasticsearch的限制,可以考虑减少数据量。可以通过以下方法来减少数据量: - 分批处理数据:将大数据集分成多个较小的批次进行处理,以避免超过限制。 - 压缩数据:使用压缩算法对数据进行压缩,以减少数据的大小。 - 删除不必要的字段:如果数据中包含不必要的字段,可以考虑删除这些字段以减少数据量。 3. 增加Elasticsearch集群的规模:如果以上方法无法解决问题,可以考虑增加Elasticsearch集群的规模,以提供更多的资源来处理大数据量。 请注意,具体的解决方法可能因为你的具体情况而有所不同。建议根据实际情况选择适合的方法来解决问题
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值