Elasticsearch start :failed to resolve host [host1]

I deploy my project on the cloud server.My OS is Linux.
I launch the Elasticsearch and recieve the log:

[2018-06-19T10:57:01,485][INFO ][o.e.t.TransportService   ] [OYN0im5] publish_address {172.18.183.220:9300}, bound_addresses {172.18.183.220:9300}

[2018-06-19T10:57:01,645][WARN ][o.e.d.z.UnicastZenPing   ] [OYN0im5] failed to resolve host [host1]
java.net.UnknownHostException: host1: Name or service not known
	at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[?:1.8.0_171]
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[?:1.8.0_171]
	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[?:1.8.0_171]
	at java.net.InetAddress.getAllByName0(InetAddress.java:1276) ~[?:1.8.0_171]
	
	at org.elasticsearch.transport.TcpTransport.parse(TcpTransport.java:918) ~[elasticsearch-6.2.4.jar:6.2.4]
	at org.elasticsearch.transport.TcpTransport.addressesFromString(TcpTransport.java:873) ~[elasticsearch-6.2.4.jar:6.2.4]
	at org.elasticsearch.transport.TransportService.addressesFromString(TransportService.java:703) ~[elasticsearch-6.2.4.jar:6.2.4]
	at org.elasticsearch.discovery.zen.UnicastZenPing.lambda$resolveHostsLists$0(UnicastZenPing.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_171]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:573) [elasticsearch-6.2.4.jar:6.2.4]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_171]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_171]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
[2018-06-19T10:57:01,651][WARN ][o.e.d.z.UnicastZenPing   ] [OYN0im5] failed to resolve host [host2]
java.net.UnknownHostException: host2: Name or service not known
	at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[?:1.8.0_171]
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[?:1.8.0_171]
	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[?:1.8.0_171]
	at java.net.InetAddress.getAllByName0(InetAddress.java:1276) ~[?:1.8.0_171]
	at java.net.InetAddress.getAllByName(InetAddress.java:1192) ~[?:1.8.0_171]
	at java.net.InetAddress.getAllByName(InetAddress.java:1126) ~[?:1.8.0_171]
	at org.elasticsearch.transport.TcpTransport.parse(TcpTransport.java:918) ~[elasticsearch-6.2.4.jar:6.2.4]
	at org.elasticsearch.transport.TcpTransport.addressesFromString(TcpTransport.java:873) ~[elasticsearch-6.2.4.jar:6.2.4]
	at org.elasticsearch.transport.TransportService.addressesFromString(TransportService.java:703) ~[elasticsearch-6.2.4.jar:6.2.4]
	at org.elasticsearch.discovery.zen.UnicastZenPing.lambda$resolveHostsLists$0(UnicastZenPing.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_171]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:573) [elasticsearch-6.2.4.jar:6.2.4]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_171]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_171]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
[2018-06-19T10:57:04,717][INFO ][o.e.c.s.MasterService    ] [OYN0im5] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {OYN0im5}{OYN0im58QKC3soPEZN5vcw}{2xtHhSxrTCS3TdD-nstLDA}{172.18.183.220}{172.18.183.220:9300}
[2018-06-19T10:57:04,725][INFO ][o.e.c.s.ClusterApplierService] [OYN0im5] new_master {OYN0im5}{OYN0im58QKC3soPEZN5vcw}{2xtHhSxrTCS3TdD-nstLDA}{172.18.183.220}{172.18.183.220:9300}, reason: apply cluster state (from master [master {OYN0im5}{OYN0im58QKC3soPEZN5vcw}{2xtHhSxrTCS3TdD-nstLDA}{172.18.183.220}{172.18.183.220:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2018-06-19T10:57:04,789][INFO ][o.e.h.n.Netty4HttpServerTransport] [OYN0im5] publish_address {172.18.183.220:9200}, bound_addresses {172.18.183.220:9200}
[2018-06-19T10:57:04,789][INFO ][o.e.n.Node               ] [OYN0im5] started
[2018-06-19T10:57:04,802][INFO ][o.e.g.GatewayService     ] [OYN0im5] recovered [0] indices into cluster_state

I find the error '[OYN0im5] failed to resolve host [host1]' in the log.
my elasticsearch.yml
# ---------------------------------- Cluster -----------------------------------

#
 cluster.name: inforsearch
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1

# Add custom attributes to the node:
#
#node.attr.rack: r1

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
 network.host: 172.18.183.220
# network.bind_host: 0.0.0.0
#
# Set a custom port for HTTP:
#
 http.port: 9200

And I launch the Kibana and recieve:
log [03:01:40.696] [info][status][plugin:kibana@6.2.4] Status changed from uninitialized to green - Ready
log [03:01:40.775] [info][status][plugin:elasticsearch@6.2.4] Status changed from uninitialized to yellow - Waiting for Elasticsearch
log [03:01:41.007] [info][status][plugin:timelion@6.2.4] Status changed from uninitialized to green - Ready
log [03:01:41.017] [info][status][plugin:console@6.2.4] Status changed from uninitialized to green - Ready
log [03:01:41.025] [info][status][plugin:metrics@6.2.4] Status changed from uninitialized to green - Ready
log [03:01:41.057] [fatal] Port 5601 is already in use. Another instance of Kibana may be running!
FATAL Port 5601 is already in use. Another instance of Kibana may be running!

I use ps -ef | grep node to see the node
[GZC@foxbert bin]$ ps -ef | grep node
GZC 7216 7093 0 11:03 pts/1 00:00:00 grep --color=auto node
GZC 8445 1 0 Jun13 ? 00:06:00 ./../node/bin/node --no-warnings ./../src/cli

# ps -ef | grep kibana
root      8181  7403  0 11:21 pts/1    00:00:00 grep --color=auto kibana

my kibana.yml
# Kibana is served by a back end server. This setting specifies the port to use.
server.port: 5601

# To allow connections from remote users, set this parameter to a non-loopback address.
#server.host: "localhost"
server.host: "172.18.183.220"
# The Kibana server's name.  This is used for display purposes.
#server.name: "your-hostname"

# The URL of the Elasticsearch instance to use for all your queries.
elasticsearch.url: "http://120.79.223.63:9200"

What should I do?

I don't think you posted your full elasticsearch.yml file.

I believe you have uncommented this line:

discovery.zen.ping.unicast.hosts: ["host1", "host2"]

which tells Elasticsearch to go looking for other nodes for this cluster on machines host1 and host2.

If you want to configure an Elasticsearch cluster, then you will need to update that list to include the names of your actual servers.

1 Like