Not able to access my elasticsearch url via public IP

Hi All,

I am not able to able to access url via public IP on port 9200.
Even when i changed below setting in config file and tried to restart service, getting below error.

network.host: <public_ip>
http.port: 9200

root@ip-10-0-1-104:/home/ubuntu# systemctl restart Elasticsearch
Job for Elasticsearch.service failed because the control process exited with error code.
See "systemctl status Elasticsearch.service" and "journalctl -xe" for details.
root@ip-10-0-1-104:/home/ubuntu#

root@ip-10-0-1-104:/home/ubuntu# journalctl -xe
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketCh>
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:5>
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipe>
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHa>
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerC>
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:97>
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:260)
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExe>
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThread>
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventE>
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]:         at java.base/java.lang.Thread.run(Thread.java:833)
Mar 30 14:52:57 ip-10-0-1-104 systemd-entrypoint[10226]: For complete error details, refer to the log at /var/log/elasticsearch/elasticsearch.l>
Mar 30 14:52:58 ip-10-0-1-104 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit elasticsearch.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Mar 30 14:52:58 ip-10-0-1-104 systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit elasticsearch.service has entered the 'failed' state with result 'exit-code'.
Mar 30 14:52:58 ip-10-0-1-104 systemd[1]: Failed to start Elasticsearch.
-- Subject: A start job for unit elasticsearch.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit elasticsearch.service has finished with a failure.
-- 
-- The job identifier is 3546 and the job result is failed.
root@ip-10-0-1-104:/home/ubuntu# tail -f /var/log/elasticsearch/elasticsearch.log 
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[?:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[?:?]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
[2022-03-30T14:52:58,457][INFO ][o.e.n.Node               ] [ip-10-0-1-104] stopping ...
[2022-03-30T14:52:58,465][INFO ][o.e.n.Node               ] [ip-10-0-1-104] stopped
[2022-03-30T14:52:58,466][INFO ][o.e.n.Node               ] [ip-10-0-1-104] closing ...
[2022-03-30T14:52:58,480][INFO ][o.e.n.Node               ] [ip-10-0-1-104] closed
[2022-03-30T14:52:58,482][INFO ][o.e.x.m.p.NativeController] [ip-10-0-1-104] Native controller process has stopped - no new native processes can be started


Hello,

Your post is in the wrong forum, please try to edit it and move to the Elasticsearch forum.

Also, Elasticsearch can only bind to IPs that exist in the host, if your public IP does not exist in the host, you will not be able to bind to it, this is probably your case.

Hello,
Thanks for your reply!
You mean public should be attached to instance ?. If yes It is already associated with instance.
I have checked security group also and found port 9200 is opened.

The Elasticsearch process can only bind to IP address that are available directly to the host.

On cloud services when you associate a public IP to an instance it creates a NAT for that public IP to the private IP of your instance, the public IP is not available directly to the host.

You need to use network.host as 0.0.0.0, this will bind the process to every IP available in the host.

After Elasticsearch is running, to connect using the public IP associated to your instance will depend on the network and security configuration of your cloud provider.

Also, do not expose your Elasticsearch instance to the internet without configuring security first.

I tried network.host as 0.0.0.0 but getting same error while restarting the service.
When i try network.host as 127.0.0.1` , I am able to restart service.

Is there anything you guess, I am missing at my end ?.

What is the error when you try to start using 0.0.0.0?

You need to share the more of the log error, do not use tail -f as this only get the last lines, try to start again and look at the Elasticsearch log file and share the error.

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