简体   繁体   中英

Adding x-pack enabled Elasticsearch behind AWS application load balancer causing health check failure due to missing authentication

I was using Application load balancer(ALB) on my elasticsearch node and configured the health check as shown in image and health check was working fine and I was able to reach to my ES using load balancer.

在此处输入图像描述

Now I added x-pack security which requires even for health check to pass a user(Elastic super user and its password) in my case and after that health check stopped working as ALB can't pass the basic authentication and due to this issue Health check is not working and as shown in image ALB is continuously de-registering the Elasticsearch which in turn causing my Elasticsearch docker to stop/start.

Note:- I am using ES 7.7 if its relevant to this question.

在此处输入图像描述

Based on the comments, the problem is caused by the fact that ALB health checks fail since failed authentication returns 401 HTTP code , not 200.

The solution is to use 401 code as the expected code for the health check. The failure of authentication still means that the ES is up and running, not that it ES failed.

What I did:

I pointed the path to the favicon image, as it does not need any authentication and gives 200 on success.

Suppose If ES is down then this will also throw a non-healthy response code.

/favicon.ico 200

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM