您好,登錄后才能下訂單哦!
看了下es-hadoop插件的源碼:
發(fā)現(xiàn)ES導(dǎo)入數(shù)據(jù)重試情況的發(fā)生,除了在es.batch.write.retry.policy參數(shù)默認開啟且es-hadoop插件向ES集群發(fā)送bulk寫入請求接受到503響應(yīng)碼會重試3次之外。
本身執(zhí)行http請求時,也會存在重試(hadoop/rest/NetworkClient.java):
public Response execute(Request request) {
Response response = null;
boolean newNode;
do {
SimpleRequest routedRequest = new SimpleRequest(request.method(), null, request.path(), request.params(), request.body());
newNode = false;
try {
response = currentTransport.execute(routedRequest);
ByteSequence body = routedRequest.body();
if (body != null) {
stats.bytesSent += body.length();
}
} catch (Exception ex) {
// configuration error - including SSL/PKI - bail out
if (ex instanceof EsHadoopIllegalStateException) {
throw (EsHadoopException) ex;
}
// issues with the SSL handshake, bail out instead of retry, for security reasons
if (ex instanceof javax.net.ssl.SSLException) {
throw new EsHadoopTransportException(ex);
}
// check for fatal, non-recoverable network exceptions
if (ex instanceof BindException) {
throw new EsHadoopTransportException(ex);
}
if (log.isTraceEnabled()) {
log.trace(
String.format(
"Caught exception while performing request [%s][%s] - falling back to the next node in line...",
currentNode, request.path()), ex);
}
String failed = currentNode;
failedNodes.put(failed, ex);
newNode = selectNextNode();
log.error(String.format("Node [%s] failed (%s); "
+ (newNode ? "selected next node [" + currentNode + "]" : "no other nodes left - aborting..."),
failed, ex.getMessage()));
if (!newNode) {
throw new EsHadoopNoNodesLeftException(failedNodes);
}
}
} while (newNode);
return response;
}
當請求出現(xiàn)超時的情況時,es-hadoop插件會再請求一個ES節(jié)點發(fā)送寫入請求。即導(dǎo)入插件認為當前插入節(jié)點超時了(默認是一分鐘)就視為該節(jié)點不可用,就換下一個節(jié)點,其實是ES在一分鐘內(nèi)沒有處理完插入任務(wù)。
將超時時間es.http.timeout參數(shù)調(diào)大之后,給ES留下充足的入庫時間,就不會再發(fā)生這個問題了。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。