0

I am using elastic.v3 (for Elasticsearch 2.3/2.4)

In order to load balance, I use nginx to do the reverse proxy。It provides an agent address.Through the curl command I can random access to the nodes in the cluster with the agent address,but how to connect the cluster thorough the agent address use elastic.v3 client for load balance?

halfer
  • 19,824
  • 17
  • 99
  • 186
xiaolong
  • 1
  • 1
  • 1

1 Answers1

1

You should have the routing to your elasticsearch cluster as such within your configuration:

server {
    listen 8080;
    location / {
        proxy_pass http://localhost:9200;
    }
}

Maybe you might want to have a look at these: Deploying NGINX Plus with Elasticsearch & Setting up nginx for ES. Hope it helps to get started.

Kulasangar
  • 9,046
  • 5
  • 51
  • 82
  • 1
    You can also add `proxy_set_header X-Real-IP $remote_addr;` and `proxy_set_header Host $http_host;` to send remote addresses to your host. And also, You can set a password with basit auth `auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd;` – hkulekci Dec 01 '16 at 12:03