Rose
Rose

Reputation: 1498

Elasticsearch Error : BindTransportException[Failed to bind to [9300-9400]

I have installed elasticsearch latest version 5.5 on my CentOS server. In order to change the IP address, I have added the below lines in elasticsearch.yml file:

network.host = xyz.xyz.xy.xy (My Centos IP address)
http.port: 9200

When I start my elasticsearch, I am getting the below errors:

[2017-08-02T12:26:08,667][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:127) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.1.jar:5.5.1]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to [9300-9400]
        at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:793) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:758) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:173) ~[?:?]
        at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:69) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.transport.TransportService.doStart(TransportService.java:209) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:69) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.node.Node.start(Node.java:692) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:277) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:360) ~[elasticsearch-5.5.1.jar:5.5.1]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.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) ~[?:?]
        at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128) ~[?:?]
        at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:554) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1258) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:980) ~[?:?]
        at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:250) ~[?:?]
        at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:365) ~[?:?]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) ~[?:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) ~[?:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]

I am able to start elasticsearch without editing my elasticsearch.yml. But I have to access elasticsearch outside of my centos machine. Is there any other setting that I should change to make it work. Any help is appreciated

Upvotes: 3

Views: 12492

Answers (2)

dr0i
dr0i

Reputation: 2470

I had the same error. It vanished after following Unable to bind elasticsearch transport service to external interface.

Newer elasticsearch versions distinguish between development mode and production mode. If you define any non-loopback IP (i.e. most probably anything else than 127.0.0.1) there will be some tests. From the logs:

... bound or publishing to a non-loopback address, enforcing bootstrap checks ... node validation exception [1] bootstrap checks failed [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

So, if you need a non-loopback IP, e.g. define in elasticsearch.yml:

node.name: $myNodeName cluster.initial_master_nodes : $myNodeName

and restart again.

Upvotes: 0

alr
alr

Reputation: 1804

Is is possible that are you trying to bind to an IP address to listen on via the network.host or bind.host parameters, that does not exist on this system?

Can you share the output of ip addr list and your elasticsearch.yml file (you can just use grep "^[^#]" elasticsearch.yml to ignore comments.

Upvotes: 2

Related Questions