一尘不染

elasticsearch-Ubuntu-拒绝连接

elasticsearch

我已经在Ubuntu 14.04上安装了弹性2.2。我保留了elastic的默认初始设置,并且该实例可从localhost:9200到达该系统的弹性实例。

现在,当我尝试使用服务器的IP / DNS名称通过其他系统通过以下方式进行操作时:

curl -XGET "http://<IP_ADDRESS_UBUNTU_SERVER>:9200"

我收到如下错误:

Failed to connect to <IP_ADDRESS_UBUNTU_SERVER> port 9200: Connection refused

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

network.host: 0.0.0.0
http.port: 9200

但这并不能解决问题。我设置了与拒绝连接相同的错误。实际上设置上述参数并尝试使用localhost:9200从服务器进行访问也会产生连接超时错误。

现在需要配置什么,以便可以从外部访问此弹性实例?

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

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)

阅读 525

收藏
2020-06-22

共1个答案

一尘不染

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

网络和端口必须以YML格式指定,如下所示:

network:
  host: 0.0.0.0
http:
  port: 9200

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

tcp 0 0 0.0.0.0:9200 0.0.0.0:* LISTEN

希望这对您有所帮助,并祝您搜索愉快。

2020-06-22