I have set up a nginx docker container to act as a load balancer for the elasticsearch cluster. Each elasticsearch node is within their own container on separate vms. When I curl to the nginx container I can see that they are successfully doing a form of round robin and redirect me to a elasticsearch container. However, when I deploy a kibana docker container onto the same vm with the nginx container and point the elasticsearch URL to the nginx load balancer, kibana would say that "unable to connect to Elasticsearch at http://". Wondering if anyone has any solutions for this?
nginx config file:
# in the 'http' context
#proxy_cache_path /var/cache/nginx/cache keys_zone=elasticsearch:10m inactive=60m;
events {
worker_connections 4096; ## Default: 1024
}
http {
upstream elasticsearch_servers {
zone elasticsearch_servers 64K;
server <elasticsearch server0>:9200;
server <elasticsearch server1>:9200;
server <elasticsearch server2>:9200;
server <elasticsearch server3>:9200;
server <elasticsearch server4>:9200;
keepalive 15;
}
server {
listen 8080;
location / {
proxy_pass http://elasticsearch_servers;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
proxy_connect_timeout 5s;
proxy_read_timeout 10s;
}
}
}
@whiranpat it looks like your elasticsearch.url is set to a Kibana host. That setting should point to an Elasticsearch node, generally a dedicated coordinator node, hopefully not the master or other master-eligable nodes, though it can point to any node in the cluster.
@Mike.Barretta The URL that we have is a dedicated VM that is housing the Kibana docker container and a Nginx docker container. The idea we are trying to do is have the Kibana docker container point the Elasticsearch.url to the Nginx docker container which acts like a load balancer to point to the other VMs that are hosting Elasticsearch docker containers.
I saw multiple documents that reference this as a solution to spread the load across the Elasticsearch cluster instead of piling everything onto one node. Even the Nginx site has some reference to this. So I was wondering if there something new in the elastic stack 6 that prevent this from happening?
Confirmation of Nginx container reaching other Elasticsearch containers:
We have use postman and curl to verify that the Nginx container was successfully able to establish communication to the Elasticsearch containers.
@whiranpat no, there isn't anything done in v6 that would prevent this all from working.
OK, so have the ES cluster, have an nginx load balancer able to connect to each of the ES nodes, and have Kibana container running on same VM hosting the nginx load balancer.
Since you can verify that nginx-to-ES works, can you verify that you can reach the nginx container from the kibana container? If you launch a shell on the running kinana container, you should be able to try and curl or ping the nginx container:
@Mike.Barretta Thanks for the help. The Kibana container wasn't able to connect to the Nginx container as you mention. This really pointed me to the correct path. I look into docker documentations and notice this "--net=host", I then proceed to add this to the docker container command and it was successful. Thank you for the help.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.