[英]How to connect to multiple master nodes of elastic search cluster
I have an elastic search cluster with two master nodes and two data nodes.我有一个带有两个主节点和两个数据节点的弹性搜索集群。 And I need to connect to an elastic search cluster with two master nodes from spring boot.
我需要从 spring 引导连接到具有两个主节点的弹性搜索集群。
Is anybody knows how to connect the multinode elastic search cluster from spring boot?有人知道如何从 spring 引导连接多节点弹性搜索集群吗?
In Elasticsearch cluster you can connect to any node ip and that node will forward the request to other nodes in the Elasticsearch cluster, but this is not a ideal way of connecting to Elasticsearch cluster as that way single node becomes bottleneck and if that nodes goes down you will not be able to connect to Elasticsearch cluster. In Elasticsearch cluster you can connect to any node ip and that node will forward the request to other nodes in the Elasticsearch cluster, but this is not a ideal way of connecting to Elasticsearch cluster as that way single node becomes bottleneck and if that nodes goes down您将无法连接到 Elasticsearch 集群。
Best is to create a load balancer on top of all your Elasticsearch nodes and connect to your load balancer that will forward request to underlying Elasticsearch nodes.最好是在所有 Elasticsearch 节点之上创建一个负载均衡器,并连接到您的负载均衡器,该负载均衡器会将请求转发到底层 Elasticsearch 节点。
If you can't create load balancer, instead of single node you can give all nodes ip in your Elasticsearch connection setting to avoid the problem described earlier and also very common as well.如果您不能创建负载均衡器,而不是单个节点,您可以在 Elasticsearch 连接设置中为所有节点提供 ip 以避免前面描述的问题,这也是非常常见的问题。
You can create a Elasticsearch client by passing multiple Elasticsearch nodes in the client builder.您可以通过在客户端构建器中传递多个 Elasticsearch 节点来创建 Elasticsearch 客户端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.