如何使用Nginx与Elasticsearch集群连接以进行反向代理? [英] How to connect with an Elasticsearch cluster using Nginx to do the reverse proxy?

查看:78
本文介绍了如何使用Nginx与Elasticsearch集群连接以进行反向代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用elastic.v3(适用于Elasticsearch 2.3/2.4)

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

为了达到负载平衡,我使用nginx做反向代理.它提供了一个代理地址.通过curl命令,我可以使用代理地址随机访问集群中的节点,但是如何彻底地连接集群.代理地址使用elastic.v3客户端实现负载平衡?

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?

推荐答案

在配置中,您应该这样路由到 elasticsearch 集群:

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

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

也许您可能想看看这些内容:部署NGINX Plus与Elasticsearch &为ES设置nginx .希望它对入门有所帮助.

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.

这篇关于如何使用Nginx与Elasticsearch集群连接以进行反向代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆