且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Amazon EC2电脑创建弹性搜索集群?

更新时间:2023-02-19 08:33:12

您的主机没有看到对方,因为您的 network.host 设置不使用正确的IP地址:



在host1上,您需要这个配置:

  network.host:10.0.1.2 
http.port:8200
discovery.zen.ping.unicast.hosts:[ 10.0.3.4]
cloud.aws.access_key:abc
cloud.aws.secret_key:xyz

在host2上你需要这个配置:

  network.host:10.0.3.4 
http.port:8200
discovery.zen.ping.unicast.hosts:[10.0.1.2]
cloud.aws.a ccess_key:abc
cloud.aws.secret_key:xyz

也可以在 discovery.zen.ping.unicast.hosts 中同时拥有两个主机,这将简化自动部署,但上述应该可以正常工作。


I have two computers running in Amazon EC2. I want to setup an Elasticsearch cluster between them. I have installed the EC2 Discovery Plugin and also I have included Zen Discovery configuration in their YMLs. Despite these, the cluster is not being formed. Both are starting as independent nodes.

My network and discovery settings are:

network.host: 0.0.0.0
http.port: 8200
discovery.zen.ping.unicast.hosts: ["10.0.1.2", "10.0.3.4"]
cloud.aws.access_key: "abc"
cloud.aws.secret_key: "xyz"

What other steps should I take to start the cluster?

Your hosts are not seeing each other because your network.host setting doesn't use the correct IP address:

On host1 you need this config:

network.host: 10.0.1.2
http.port: 8200
discovery.zen.ping.unicast.hosts: ["10.0.3.4"]
cloud.aws.access_key: "abc"
cloud.aws.secret_key: "xyz"

On host2 you need this config:

network.host: 10.0.3.4
http.port: 8200
discovery.zen.ping.unicast.hosts: ["10.0.1.2"]
cloud.aws.access_key: "abc"
cloud.aws.secret_key: "xyz"

To simplify you can also have both hosts in the discovery.zen.ping.unicast.hosts, that will simplify automated deployments, but the above should work.