Getting Cannot assign requested address while starting elasticsearch

I am not able to get perfect solution from any of the previously posted question so I am asking this again as I am a newbie to elastic. Here what all I have done

  1. Installed elasticsearch on linux using git clone.
  2. Running elastic using /bin/elasticsearch
  3. Runs successfully when there in no change in elasticsearch.yml file
  4. When I am changing the network.host: 192.168.0.1 to #network.host: 10.182.XX.XX it is not able to start.

Linux Installed

cat /proc/version
Linux version 2.6.32-696.23.1.el6.x86_64 (mockbuild@x86-027.build.eng.bos.redhat.com)

Console snapshot

[2018-07-24T19:52:49,248][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300-9400]]; nested: BindException[Cannot assign requested address];
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.1.jar:6.3.1]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.1.jar:6.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.1.jar:6.3.1]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to [9300-9400]
at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:809) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:774) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:135) ~[?:?]
at org.elasticsearch.xpack.core.security.transport.netty4.SecurityNetty4Transport.doStart(SecurityNetty4Transport.java:85) ~[?:?]
at org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4ServerTransport.doStart(SecurityNetty4ServerTransport.java:41) ~[?:?]
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:66) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.transport.TransportService.doStart(TransportService.java:213) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:66) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.node.Node.start(Node.java:652) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:265) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:335) ~[elasticsearch-6.3.1.jar:6.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.3.1.jar:6.3.1]
... 6 more
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
at sun.nio.ch.Net.bind(Net.java:433) ~[?:?]
at sun.nio.ch.Net.bind(Net.java:425) ~[?:?]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[?:?]

Looks like there is no support available in this forum. Sorry for the inconvenience.

Hi dhananjay,

This seems that you are assigning an IP to elasticsearch that doesn't seem to allotted to the machine.

Could change the network.host value to the IP address of the machine?

What is the o/p of ip addr?

Thanks for replying. I am assigning the host address (ssh ip) in network.host.

Are you sure that is the actual IP of the host and not a NAT/PAT IP?

What is the output of ip addr on the remote machine?

I think you are right. Please see the ip addr output
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc pfifo_fast state UP qlen 1000
link/ether fa:16:3e:81:4d:e8 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.41/24 brd 192.168.0.255 scope global eth0

I should give the IP 192.168.0.41 in network.host right ?

Since you are behind a NAT IP, you will have to keep the IP as localhost.

What is the use case? Are you planning to use Kibana as well or just elasticsearch?

I want to get the server details (like CPU load, Memory size etc) using Elasticsearch and display it on Microsoft Bi dashboard.

You could either do a port opening or set up elasticsearch behind a reverse proxy.

Please note that there are some security issues with exposing elasticsearch directly without authentication and authorization. See xpack for more details.

Port opening - do you mean open the port 9200 in firewall ?
Can you please share a link for more information so that I can explore.

https://www.elastic.co/guide/en/elastic-stack-overview/current/index.html

https://www.elastic.co/guide/en/elastic-stack-overview/current/security-getting-started.html

yes.

Thanks a lot @NerdSec. Will be thankful for your kind support.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.