Reputation: 223
I have installed elastic 2.2 on an Ubuntu 14.04. I left the default initial settings of elastic and the elastic instance was reachable form this system at localhost:9200.
Now when I tried via a different system using the IP/DNS name of the server as:
curl -XGET "http://<IP_ADDRESS_UBUNTU_SERVER>:9200"
I get an error as :
Failed to connect to <IP_ADDRESS_UBUNTU_SERVER> port 9200: Connection refused
I tried changing few parameters in elasticsearch.yml file and set it as:
network.host: 0.0.0.0
http.port: 9200
but this did not solve the issue. I set get the same error as connection refused. In-fact setting the above parameters and trying to access from the server using localhost:9200 also gave a connection timed-out error.
Now what is the configuration, I need to set so that this elastic instance is accessible from outside?
EDIT: I tried to set the IP Address of the Ubuntu server as network.host, but I see the following errors in the log files:
BindTransportException[Failed to bind to [9300-9400]]; nested: ChannelException[Failed to bind to: /10.173.1.176:9400]; nested: BindException[Cannot assign requested address];
at org.elasticsearch.transport.netty.NettyTransport.bindToPort(NettyTransport.java:477)
at org.elasticsearch.transport.netty.NettyTransport.bindServerBootstrap(NettyTransport.java:439)
at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:320)
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
at org.elasticsearch.transport.TransportService.doStart(TransportService.java:170)
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
at org.elasticsearch.node.Node.start(Node.java:252)
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:221)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:287)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /10.173.1.176:9400
at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
at org.elasticsearch.transport.netty.NettyTransport$1.onPortNumber(NettyTransport.java:459)
at org.elasticsearch.common.transport.PortsRange.iterate(PortsRange.java:69)
at org.elasticsearch.transport.netty.NettyTransport.bindToPort(NettyTransport.java:455)
... 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:1142)
Upvotes: 2
Views: 10568
Reputation: 13926
In addition to getting things right in the config.yml, if you're writing your own unit file, you will need to pass the boot checks by setting some settings in the unit file (not just in sysctl.conf). So in /lib/systemd/system/elasticsearch.service
Make sure you have these settings in the indicating sections:
[Unit]
LimitMEMLOCK=infinity
[Service]
LimitNOFILE=65536
Upvotes: 0
Reputation: 223
This was caused due to an error in the config file. I did not adhere to the YAML guidelines and was blindly following the elastic help doc..
The network and the port has to be specified in the YML format as below:
network:
host: 0.0.0.0
http:
port: 9200
After this restart the elastic service. If something goes wrong, refer to elastic log files and check if the instance is bound to the above IP and port 9200. You can also check the listening IP/port (netstat -l -n) . There has to be an entry like:
tcp 0 0 0.0.0.0:9200 0.0.0.0:* LISTEN
Hope this helps and happy searching..
Upvotes: 8