弹性搜索 - Ubuntu - 连接被拒绝 [英] Elastic Search - Ubuntu - Connection Refused

查看:230
本文介绍了弹性搜索 - Ubuntu - 连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 14.04上安装了弹性2.2。我离开了弹性的默认初始设置,弹性实例可以从本系统在localhost:9200到达。



现在,当我尝试通过不同的系统使用IP / DNS服务器的名称为:

  curl -XGEThttp://< IP_ADDRESS_UBUNTU_SERVER>:9200

我收到错误:

 无法连接到< IP_ADDRESS_UBUNTU_SERVER>端口9200:连接拒绝

我尝试更改elasticsearch.yml文件中的几个参数,并将其设置为: / p>

  network.host:0.0.0.0 
http.port:9200

但这并没有解决问题。我设置得到与连接拒绝相同的错误。事实上,设置上述参数并尝试使用localhost:9200从服务器访问也给出了连接超时错误。



现在我需要什么配置设置使得这个弹性实例可以从外部访问?



编辑:
我试图将Ubuntu服务器的IP地址设置为network.host,但是我在日志文件中看到以下错误:

  BindTransportException [无法绑定到[9300-9400]];嵌套:ChannelException [无法绑定到:/10.173.1.176:9400];嵌套:BindException [无法分配请求的地址]; 
在org.elasticsearch.transport.netty.NettyTransport.bindToPort(NettyTransport.java:477)
在org.elasticsearch.transport.netty.NettyTransport.bindServerBootstrap(NettyTransport.java:439)
在org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:320)
在org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
在org.elasticsearch .transport.TransportService.doStart(TransportService.java:170)
在org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
在org.elasticsearch.node.Node.start (Node.java:252)
在org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:221)
在org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:287)
在org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
导致:org.jboss.netty.channel.Chann elException:无法绑定到:/10.173.1.176:9400
在org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
在org.elasticsearch.transport.netty.NettyTransport $ 1.onPortNumber(NettyTransport.java:459)
在org.elasticsearch.common.transport.PortsRange.iterate(PortsRange.java:69)
在org.elasticsearch.transport.netty.NettyTransport.bindToPort( NettyTransport.java:455)
... 9更多
导致:java.net.BindException:无法在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)
在sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
在org.jboss.netty.channel.socket.nio .NioServerBoss $ RegisterTask.run(NioServerBoss.java:193)
在org.jboss.netty.channel .socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:391)
在org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:315)
在org.jboss .netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
在org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
在org.jboss .netty.util.internal.DeadLockProofWorker $ 1.run(DeadLockProofWorker.java:42)
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)


解决方案

这是由于配置文件中的错误引起的。我没有遵守YAML指南,并且盲目遵循弹性帮助文档。



网络和端口必须以YML格式指定如下: / p>

 网络:
主机:0.0.0.0
http:
端口:9200

此次重新启动弹性服务。如果出现问题,请参阅弹性日志文件,并检查实例是否绑定到上述IP和端口9200.您还可以检查侦听IP /端口(netstat -l -n)。必须有一个条目,如:

  tcp 0 0 0.0.0.0:9200 0.0.0.0:* LISTEN 

希望这有助于快乐搜索..


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)

解决方案

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..

这篇关于弹性搜索 - Ubuntu - 连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆