本地 Kibana 未连接到本地 Elasticsearch 服务器(StreamCorruptedException?)

Local Kibana not Connecting to Local Elasticsearch Server (StreamCorruptedException?)

所以我设置了 Elasticsearch,我有服务器 运行。当我连接到 http://localhost:9200/ 时,我收到了状态消息。是版本号1.4.3.

现在我下载Kibana 3.1.2。按照自述文件中的说明,我将以下行添加到配置文件 elasticsearch.yml

# making kibana local work
http.cors.enabled: true
http.cors.allow-origin: 127.0.0.1

我还将以下行添加到 Kibana 的 config.js:

elasticsearch: 'http://localhost:9200',

当我在最新的 Firefox 中导航到 Kibana 的 index.html 时,我看到一个页面说明:

Connection Failed
Possibility #1: Your elasticsearch server is down or unreachable.......

现在我已经为配置文件尝试了一些其他变量,但它似乎应该可以工作。两者都存在于我的本地 Ubuntu 14.04/64 位安装中。

当我检查 elasticsearch.log 时,我发现以下内容:

[2015-02-18 13:50:12,697][INFO ][node                     ] [Puma] version[1.4.3], pid[14592], build[36a29a7/2015-02-11T14:23:15Z]
[2015-02-18 13:50:12,698][INFO ][node                     ] [Puma] initializing ...
[2015-02-18 13:50:12,706][INFO ][plugins                  ] [Puma] loaded [], sites []
[2015-02-18 13:50:16,540][INFO ][node                     ] [Puma] initialized
[2015-02-18 13:50:16,540][INFO ][node                     ] [Puma] starting ...
[2015-02-18 13:50:16,735][INFO ][transport                ] [Puma] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.192.25:9300]}
[2015-02-18 13:50:16,761][INFO ][discovery                ] [Puma] elasticsearch/zEjlD0HdR2OtpjykOo1e7g
[2015-02-18 13:50:20,542][INFO ][cluster.service          ] [Puma] new_master [Puma][zEjlD0HdR2OtpjykOo1e7g][zirconcode][inet[/192.168.192.25:9300]], reason: zen-disco-join (elected_as_master)
[2015-02-18 13:50:20,569][INFO ][http                     ] [Puma] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.192.25:9200]}
[2015-02-18 13:50:20,570][INFO ][node                     ] [Puma] started
[2015-02-18 13:50:20,632][INFO ][gateway                  ] [Puma] recovered [0] indices into cluster_state
[2015-02-18 13:50:29,195][WARN ][transport.netty          ] [Puma] exception caught on transport layer [[id: 0x8e5c4505, /127.0.0.1:53332 => /127.0.0.1:9300]], closing connection
java.io.StreamCorruptedException: invalid internal transport message format, got (47,45,54,20)
    at org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.decode(SizeHeaderFrameDecoder.java:47)
    at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:425)
    at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
    at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
    at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
    at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
    at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
    at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
[2015-02-18 13:50:29,202][WARN ][transport.netty          ] [Puma] exception caught on transport layer [[id: 0x8e5c4505, /127.0.0.1:53332 :> /127.0.0.1:9300]], closing connection
java.io.StreamCorruptedException: invalid internal transport message format, got (47,45,54,20)
    at org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.decode(SizeHeaderFrameDecoder.java:47)
    at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:425)
    at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.cleanup(FrameDecoder.java:482)
    at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.channelDisconnected(FrameDecoder.java:365)
    at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:102)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.elasticsearch.common.netty.channel.Channels.fireChannelDisconnected(Channels.java:396)
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:360)
    at org.elasticsearch.common.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:81)
    at org.elasticsearch.common.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:36)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:574)
    at org.elasticsearch.common.netty.channel.Channels.close(Channels.java:812)
    at org.elasticsearch.common.netty.channel.AbstractChannel.close(AbstractChannel.java:197)
    at org.elasticsearch.transport.netty.NettyTransport.exceptionCaught(NettyTransport.java:622)
    at org.elasticsearch.transport.netty.MessageChannelHandler.exceptionCaught(MessageChannelHandler.java:234)
    at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377)
    at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.elasticsearch.common.netty.channel.Channels.fireExceptionCaught(Channels.java:525)
    at org.elasticsearch.common.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.notifyHandlerException(DefaultChannelPipeline.java:658)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:566)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
    at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
    at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
    at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
    at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

虽然我在多次尝试中只遇到过一次这个错误。

而不是

http.cors.allow-origin: 127.0.0.1

在你的 ES 1.4.3 elasticsearch.yml 试试

http.cors.allow-origin: "http://127.0.0.1"

假设您 运行 端口 80 上的 kibana

如果您从 http://127.0.0.1/kibana 访问 kibana,以上内容将有效。如果您改用 url http://localhost/kibana,请在您的 yml 文件

中将 127.0.0.1 替换为 localhost

按照以下步骤解决上述问题:

  1. 打开文件 elasticsearch<Version>/config/elasticsearch.yml
  2. 加一行http.cors.allow-origin: "http://127.0.0.1:5601"

现在启动elasticserch,然后启动Kibana。它现在将连接。