简体   繁体   English

如何在EC2上设置ElasticSearch节点,使其具有一致的DNS条目?

[英]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地址,我的客户端也可以继续连接?

  1. I could use Elastic IPs, but these are limited to 5 per account and I will eventually have many more than 5 nodes (different environments, dev, staging, test, etc.) 我可以使用弹性IP,但是每个帐户最多只能使用5个IP,最终我将拥有5个以上的节点(不同的环境,开发,登台,测试等)。
  2. I could use Elastic Load Balancers, and put one node behind each ELB, but that seems like a pretty hacky solution and an improper use of load balancers. 我可以使用弹性负载平衡器,并在每个ELB后面放置一个节点,但这似乎是一个非常棘手的解决方案,并且负载平衡器的使用不当。
  3. I could create my own DNS entries under my own domain and update the DNS table whenever I notice an IP address has changed, but that seems really error prone if no one is checking the IPs every day. 我可以在自己的域下创建自己的DNS条目,并在发现IP地址发生更改时更新DNS表,但是如果没有人每天检查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.

相关问题 如何设置我的应用程序/EC2 实例,以便不必将端口号放在 IP 的末尾? - How do I set up my application/EC2 instance so that I don't have to put the port number at the end of the IP? EC2卷:如何设置它以便在终止时删除? - EC2 volume: how do I set it so that it WILL delete on termination? 如何在AWS EC2上设置REST API服务器使用我的域名? - How do I have the REST API server set up on AWS EC2 use my domain name? 我是否必须设置2个EC2实例才能使用AWS ACM? - Do I have to set up 2 EC2 instances in order to use AWS ACM? 从本地主机设置EC2公共DNS - EC2 public DNS set up from localhost 如何为AWS的中国EC2实例设置备用DNS服务器? - How to set up an alternate DNS server for AWS's China EC2 instance? 如何恢复 ec2 实例。 我没有 EC2 的快照,但 EC2 没有终止,它已启动并正在运行? - How to restore ec2 instance. i dont have snaphot of the EC2, but the EC2 was not terminated it is up and running? 如何设置AWS Route 53以处理EC2单实例域 - How do I set up AWS Route 53 to handle an EC2 single instance domain 如何设置AWS EC2 Elastic Beanstalk项目以与其他人协作? - How do I set up my AWS EC2 Elastic Beanstalk project to collaborate with others? 如何使用Amazon EC2实例设置Mac ftp客户端? - How do I set up my mac ftp client with an amazon ec2 instance?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM