Problem with accessing elasticsearch remotly


(Muneer Ahmad) #1

Hi,

i am trying to access elastic search using my server public ip address since last week but not able to do so. i have tried so many solutions but not succeeded. My elasticsearch.yml file settings are like:

http.host: my server public ip address
http.port: 9200
cluster.name: pld

i want to access like this:
http://myserverip:9200/

Please someone help me
Thanks in advance
Muneer Hassan


(David Pilato) #2

Share your elasticsearch logs.

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.


(Muneer Ahmad) #3

Thanks for reply, my log is look like

[2018-06-06 11:33:46,932][INFO ][node                     ] [node-1] version[2.4.2], pid[23359],                     
build[161c65a/2016-11-17T11:51:03Z]
[2018-06-06 11:33:46,932][INFO ][node                     ] [node-1] initializing ...
[2018-06-06 11:33:47,434][INFO ][plugins                  ] [node-1] modules [reindex, lang-expression, lang- 
groovy], plugins [], sites []
[2018-06-06 11:33:47,453][INFO ][env                      ] [node-1] using [1] data paths, mounts [[/ (/dev/xvda1)]], net usable_space [197.9gb], net total_space [295.1gb], spins? [no], types [ext4]
[2018-06-06 11:33:47,453][INFO ][env                      ] [node-1] heap size [1007.3mb], compressed ordinary object pointers [true]
[2018-06-06 11:33:49,149][INFO ][node                     ] [node-1] initialized
[2018-06-06 11:33:49,149][INFO ][node                     ] [node-1] starting ...
[2018-06-06 11:33:49,218][INFO ][transport                ] [node-1] publish_address {172.31.55.82:9300}, bound_addresses {[::]:9300}
[2018-06-06 11:33:49,223][INFO ][discovery                ] [node-1] pld/y745dyoASHiNx75h08es4w
[2018-06-06 11:33:52,262][INFO ][cluster.service          ] [node-1] new_master {node-1}{y745dyoASHiNx75h08es4w}{172.31.55.82}{172.31.55.82:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2018-06-06 11:33:52,269][INFO ][http                     ] [node-1] publish_address {172.31.55.82:9200}, bound_addresses {[::]:9200}
[2018-06-06 11:33:52,269][INFO ][node                     ] [node-1] started
[2018-06-06 11:33:52,538][INFO ][gateway                  ] [node-1] recovered [22] indices into cluster_state
[2018-06-06 11:33:55,049][INFO ][cluster.routing.allocation] [node-1] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[searchterms_1512644811][0], [searchterms_1512644811][2], [searchterms_1512644811][0]] ...]).

(David Pilato) #4

What gives:

curl 172.31.55.82:9200/

?


(Muneer Ahmad) #5

it replies fine from same server, but its private ip and not accessable from browser and another server

response of (curl 172.31.55.82:9200) from same server
{
"name" : "node-1",
"cluster_name" : "pld",
"cluster_uuid" : "xOIcIrBYTceO5NEybm01KQ",
"version" : {
"number" : "2.4.2",
"build_hash" : "161c65a337d4b422ac0c805f284565cf2014bb84",
"build_timestamp" : "2016-11-17T11:51:03Z",
"build_snapshot" : false,
"lucene_version" : "5.5.2"
},
"tagline" : "You Know, for Search"
}


(David Pilato) #6

Can you bind to the public ip then?

I hope that it's not public on internet though.


(Muneer Ahmad) #7

I have bind

network.host: 0.0.0.0
http.host: public_ip

but not work, throw following exception on elasticsearch restart

BindHttpException[Failed to bind to [9200]]; nested: ChannelException[Failed to bind to: /54.210.102.235:9200]; nested: BindException[Cannot assign requested address];
	at org.elasticsearch.http.netty.NettyHttpServerTransport.bindAddress(NettyHttpServerTransport.java:391)
	at org.elasticsearch.http.netty.NettyHttpServerTransport.createBoundHttpAddress(NettyHttpServerTransport.java:289)
	at org.elasticsearch.http.netty.NettyHttpServerTransport.doStart(NettyHttpServerTransport.java:275)
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
	at org.elasticsearch.http.HttpServer.doStart(HttpServer.java:107)
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
	at org.elasticsearch.node.Node.start(Node.java:289)
	at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:222)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:288)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /public_ip:9200
	at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
	at org.elasticsearch.http.netty.NettyHttpServerTransport$1.onPortNumber(NettyHttpServerTransport.java:379)
	at org.elasticsearch.common.transport.PortsRange.iterate(PortsRange.java:58)
	at org.elasticsearch.http.netty.NettyHttpServerTransport.bindAddress(NettyHttpServerTransport.java:374)
	... 9 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 sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.jboss.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193)
	at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:391)
	at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:315)
	at org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
	at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
	at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
[2018-06-07 05:21:12,845][INFO ][node                     ] [node-1] stopping ...
[2018-06-07 05:21:13,087][INFO ][gateway                  ] [node-1] recovered [22] indices into cluster_state
[2018-06-07 05:21:13,093][INFO ][node                     ] [node-1] stopped
[2018-06-07 05:21:13,093][INFO ][node                     ] [node-1] closing ...
[2018-06-07 05:21:13,098][INFO ][node                     ] [node-1] closed

then i set

network.host: public_ip
http.host: 0.0.0.0

i receive following exception on elasticsearch restart

BindTransportException[Failed to bind to [9300-9400]]; nested: ChannelException[Failed to bind to: /public_ip:9400]; nested: BindException[Cannot assign requested address];
	at org.elasticsearch.transport.netty.NettyTransport.bindToPort(NettyTransport.java:489)
	at org.elasticsearch.transport.netty.NettyTransport.bindServerBootstrap(NettyTransport.java:451)
	at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:332)
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
	at org.elasticsearch.transport.TransportService.doStart(TransportService.java:182)
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
	at org.elasticsearch.node.Node.start(Node.java:278)
	at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:222)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:288)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /public_ip:9400
	at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
	at org.elasticsearch.transport.netty.NettyTransport$1.onPortNumber(NettyTransport.java:471)
	at org.elasticsearch.common.transport.PortsRange.iterate(PortsRange.java:69)
	at org.elasticsearch.transport.netty.NettyTransport.bindToPort(NettyTransport.java:467)
	... 9 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 sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.jboss.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193)
	at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:391)
	at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:315)
	at org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
	at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
	at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
[2018-06-07 05:26:31,647][INFO ][node                     ] [node-1] stopping ...
[2018-06-07 05:26:31,648][INFO ][node                     ] [node-1] stopped
[2018-06-07 05:26:31,648][INFO ][node                     ] [node-1] closing ...
[2018-06-07 05:26:31,652][INFO ][node                     ] [node-1] closed

(David Pilato) #8

So you don't have a network card exposing 54.210.102.235 IP.
You probably need to change some network settings (not on elasticsearch side) and "route" whatever is coming to the public IP to this private IP where elasticsearch is bound.


(Muneer Ahmad) #10

I have set

network.host: 0.0.0.0
http.host: 0.0.0.0

and set inbound rule for port 9200 on my server, now its working..

Thank You so much for supporting


(David Pilato) #11

Did you look at https://www.elastic.co/cloud ?

Cloud by elastic is the way to have access to X-Pack. Think about what is there yet like Security, Monitoring, Reporting and what is coming like Canvas, SQL...
And everything is managed for you.


(system) #12

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