-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ElasticSearch协程客户端批量插入问题 #560
Comments
你好,我是XueSi,很抱歉,之前太忙没有及时处理,今天我复现下这个问题然后再尝试修复。 |
你好,我这边测试导入 20w 条数据时是正常的,使用 ElasticSearch 官方PHP客户端 导入 50w 条数据时也报异常。异常如下: {"error":{"root_cause":[{"type":"es_rejected_execution_exception","reason":"rejected execution of coordinating operation [coordinating_and_primary_bytes=0, replica_bytes=0, all_bytes=0, coordinating_operation_bytes=110388603, max_coordinating_and_primary_bytes=103887667]"}],"type":"es_rejected_execution_exception","reason":"rejected execution of coordinating operation [coordinating_and_primary_bytes=0, replica_bytes=0, all_bytes=0, coordinating_operation_bytes=110388603, max_coordinating_and_primary_bytes=103887667]"},"status":429} 根据异常提示应该是达到了内存上限,max_coordinating_and_primary_bytes是内存的10%,建议你进行分批导入。 |
其实本质还是取决于你这10w条数据占用的大小,导入大量数据时非常吃内存的,特别是bulk这种操作,也会导致ElasticSearch服务端线程池占满,从而导致 ElasticSearch 拒绝响应。所以建议你分批导入,例如每次导入10w 或者 20w。 $errorNums = 0;
$sucNums = 0;
foreach ($r['items'] as $row) {
if (!empty($row['create'])) {
$create = $row['create'];
if (isset($create['error'])) {
var_dump($create['error']['reason']);
$errorNums += 1;
} else if (isset($create['result']) && $create['result'] == 'created') {
$sucNums += 1;
}
}
} |
你好有问题的话再QQ联系我 |
好的,我试试 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
elasticsearch批量写入,这里只会插入前10W条,新的却写入不进?(假如我sql里面写50W条,也可以写入,后面的却写不进去)
The text was updated successfully, but these errors were encountered: