[英]How do I set up ElasticSearch nodes on EC2 so they have consistent DNS entries?
I have 3 ElasticSearch nodes in a cluster on AWS EC2. 我在AWS EC2的集群中有3个ElasticSearch节点。 My client apps use connection pooling and have the public IP addresses for all 3 nodes in their config files.
我的客户端应用程序使用连接池,并在其配置文件中具有所有3个节点的公共IP地址。
The problem I have is that EC2 seems to occasionally reassign public IP addresses for these instances. 我的问题是EC2似乎偶尔会为这些实例重新分配公共IP地址。 They also change if I stop and restart an instance.
如果我停止并重新启动实例,它们也会更改。
My app will actually stay online since the connection pool will round robin the three known IP addresses, but eventually, all three will change and the app will stop working. 由于连接池将轮流轮询三个已知IP地址,因此我的应用程序实际上将保持在线状态,但最终,这三个地址都将更改并且该应用程序将停止运行。
So, how should I be setting up an ElasticSearch cluster on EC2 so that my clients can continue to connect even if the instances change IP addresses? 因此,我应该如何在EC2上设置ElasticSearch集群,以便即使实例更改IP地址,我的客户端也可以继续连接?
Is there an option I'm missing? 我有没有选择的余地?
I haven't seen the changing IP address on a running instance that you're describing, but using this approach, it shouldn't matter: 我没有看到您正在描述的正在运行的实例上更改的IP地址,但是使用这种方法,没关系:
Use DNS names for everything, not IP addresses. 将DNS名称用于所有内容,而不是IP地址。
Lets say you want to hit your cluster via http://elastic.rabblerabble.com:9200 . 假设您想通过http://elastic.rabblerabble.com:9200来访问您的集群。
Create the EC2 instances for your nodes. 为您的节点创建EC2实例。 Name them elastic-0, elastic-1, and elastic-2.
将它们命名为elastic-0,elastic-1和elastic-2。
In EC2 Load Balancers, create an ELB named 'es-elb' that includes each of these instances by name, with port forwarding of port 9200. 在EC2负载平衡器中,创建一个名为'es-elb'的ELB,该ELB按名称包含这些实例中的每一个,端口转发为端口9200。
In Route 53, create unique CNAMEs for each of your instances, with the Public DNS as the value, and a CNAME for your ELB: 在Route 53中,为每个实例创建唯一的CNAME,以Public DNS作为值,并为ELB创建CNAME:
Name Type Value
elastic-0.rabblerabble.com. CNAME Public DNS of instance elastic-0
elastic-1.rabblerabble.com. CNAME Public DNS of instance elastic-1
elastic-2.rabblerabble.com. CNAME Public DNS of instance elastic-2
elastic.rabblerabble.com. CNAME Public DNS of ELB es-elb
There's more needed for security, health checks, etc. but that's outside the scope of the question. 安全性,运行状况检查等还需要更多,但这超出了问题的范围。
Use one or two query only nodes - referred to in the documentation as "non data" nodes. 使用一个或两个仅查询节点-在文档中称为“非数据”节点。
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-node.html http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-node.html
In front of the cluster we can start one or more "non data" nodes which will start with HTTP enabled.
在集群的前面,我们可以启动一个或多个“非数据”节点,这些节点将从启用HTTP开始。 All HTTP communication will be performed through these "non data" nodes.
所有HTTP通信将通过这些“非数据”节点执行。
The benefit of using that is first the ability to create smart load balancers.
使用它的好处是首先可以创建智能负载均衡器。 These "non data" nodes are still part of the cluster, and they redirect operations exactly to the node that holds the relevant data.
这些“非数据”节点仍然是集群的一部分,它们将操作完全重定向到保存相关数据的节点。 The other benefit is the fact that for scatter / gather based operations (such as search), these nodes will take part of the processing since they will start the scatter process, and perform the actual gather processing.
另一个好处是,对于基于分散/收集的操作(例如搜索),这些节点将参与处理,因为它们将启动分散过程并执行实际的收集处理。
These nodes don't need much disk (they are query and index processing only). 这些节点不需要太多磁盘(它们仅用于查询和索引处理)。 You route all your requests thru them.
您通过它们路由所有请求。 You can add more and more data nodes as you ingest more data without changing these "non data" nodes.
随着摄取更多数据,您可以添加越来越多的数据节点,而无需更改这些“非数据”节点。 You run a couple of them (to be safe) and use either DNS or Elastic IP addresses.
您运行了其中的几个(为了安全起见),并使用DNS或弹性IP地址。 You need far fewer of the IP addresses as these are not data nodes and you tend not to need to change these as frequently as you do data nodes.
您需要的IP地址要少得多,因为它们不是数据节点,并且往往不需要像更改数据节点那样频繁地更改它们。
This configuration approach is documented in the elasticsearch.yml file, quoted below: 这种配置方法记录在elasticsearch.yml文件中,引用如下:
You want this node to be neither master nor data node, but to act as a "search load balancer" (fetching data from nodes, aggregating results, etc.)
node.master: false
node.master:否
node.data: false
node.data:否
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.