1
votes

I am trying my hands on Elastic search and am having a hard time trying to create a cluster on a single machine with 3 elastic search instances. I have made the following changes on the instanses:

  1. changed cluster name {cluster.name: es-stack} on all the instances
  2. changed node name {node.name: node-1 , node.name: node-2, node.name: node-3} on all the instances
  3. changed the http port {http.port: 9203, http.port: 9202, http.port: 9201}
  4. changed the ping unicast {discovery.zen.ping.unicast.hosts: ["127.0.0.1:9201", "127.0.0.1:9202"]}

The elasticsearch.yml on the instances looks like:

# Instance 1
cluster.name: es-stack
node.name: node-1
http.port: 9201
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9202", "127.0.0.1:9203"]

# Instance 2
cluster.name: es-stack
node.name: node-2
http.port: 9202
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9201", "127.0.0.1:9203"]

# Instance 3
cluster.name: es-stack
node.name: node-3
http.port: 9203
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9201", "127.0.0.1:9202"]

After these configuration when I am trying to start the instances, I am not able to get a cluster environment. The error trace in the log file while starting the elastic search instances says:

[2016-11-30T23:25:59,320][INFO ][o.e.t.TransportService   ] [node-2] publish_address {127.0.0.1:9301}, bound_addresses {[fe80::1]:9301}, {[::1]:9301}, {127.0.0.1:9301}
[2016-11-30T23:26:02,493][WARN ][o.e.d.z.p.u.UnicastZenPing] [node-2] [1] failed send ping to {#zen_unicast_2#}{_V9wDP7mRBWfMT35KqH63w}{::1}{[::1]:9201}
java.lang.IllegalStateException: handshake failed with {#zen_unicast_2#}{_V9wDP7mRBWfMT35KqH63w}{::1}{[::1]:9201}
    at org.elasticsearch.transport.TransportService.handshake(TransportService.java:364) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:339) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:313) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing$2.run(UnicastZenPing.java:419) [elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:444) [elasticsearch-5.0.0.jar:5.0.0]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: org.elasticsearch.transport.ReceiveTimeoutTransportException: [][[::1]:9201][internal:transport/handshake] request_id [1] timed out after [3010ms]
    at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:840) ~[elasticsearch-5.0.0.jar:5.0.0]
    ... 4 more
[2016-11-30T23:26:02,493][WARN ][o.e.d.z.p.u.UnicastZenPing] [node-2] [1] failed send ping to {#zen_unicast_1#}{AZZtXAfATv2xSWaYo9hCWQ}{127.0.0.1}{127.0.0.1:9201}
java.lang.IllegalStateException: handshake failed with {#zen_unicast_1#}{AZZtXAfATv2xSWaYo9hCWQ}{127.0.0.1}{127.0.0.1:9201}
    at org.elasticsearch.transport.TransportService.handshake(TransportService.java:364) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:339) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:313) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing$2.run(UnicastZenPing.java:419) [elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:444) [elasticsearch-5.0.0.jar:5.0.0]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: org.elasticsearch.transport.ReceiveTimeoutTransportException: [][127.0.0.1:9201][internal:transport/handshake] request_id [2] timed out after [3009ms]
    at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:840) ~[elasticsearch-5.0.0.jar:5.0.0]
    ... 4 more
[2016-11-30T23:26:02,527][INFO ][o.e.c.s.ClusterService   ] [node-2] new_master {node-2}{nx5b5yr6TWqxznjXv62wEA}{JC3v2euLRSerB4T7GL0Fyg}{127.0.0.1}{127.0.0.1:9301}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2016-11-30T23:26:02,588][INFO ][o.e.h.HttpServer         ] [node-2] publish_address {127.0.0.1:9202}, bound_addresses {[fe80::1]:9202}, {[::1]:9202}, {127.0.0.1:9202}
[2016-11-30T23:26:02,588][INFO ][o.e.n.Node               ] [node-2] started
[2016-11-30T23:26:02,605][INFO ][o.e.g.GatewayService     ] [node-2] recovered [0] indices into cluster_state

I am not able to identify what part I have missed? How to get all the instances to single cluster?

1
can you paste log file trace for each instance when you run each instanceuser3775217
I have added the error log from a instance in the question itself.Karan Khanna

1 Answers

5
votes

discovery.zen.ping.unicast.hosts takes array of host:port and here port represents transport.tcp.port and not the http.port . So your settings should look like this:

discovery.zen.ping.unicast.hosts: ["127.0.0.1:9302", "127.0.0.1:9303"]
//note: 9202 became 9302 and so on

You can read more about this setting here.

Hope this helps!