elasticsearch-windows启动时的问题

在官网上下载elasticsearch-windows后,按照官方的步骤,解压,运行bin/elasticsearch.bat,但是启动时控制台报错,错误如下:

[o.e.t.TransportService   ] [qIMyueh] publish_address {127.0.0.1:9301}, bound_addresses {127.0.0.1:9301}, {[::1]:9301}
[2021-03-14T08:50:17,909][WARN ][o.e.t.n.Netty4Transport  ] [qIMyueh] exception caught on transport layer [[id: 0xad9dc710, L:/0:0:0:0:0:0:0:1:63446 - R:/0:0:0:0:0:0:0:1:9300]], closing connection
io.netty.handler.codec.DecoderException: java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:442) ~[netty-codec-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248) ~[netty-codec-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:373) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:351) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:373) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:651) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:536) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:490) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:450) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873) [netty-common-4.1.6.Final.jar:4.1.6.Final]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
Caused by: java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50)
        at org.elasticsearch.transport.TcpTransport.validateMessageHeader(TcpTransport.java:1140) ~[elasticsearch-5.1.2.jar:5.1.2]
        at org.elasticsearch.transport.netty4.Netty4SizeHeaderFrameDecoder.decode(Netty4SizeHeaderFrameDecoder.java:36) ~[?:?]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411) ~[?:?]
        ... 15 more
[2021-03-14T08:50:17,909][WARN ][o.e.t.n.Netty4Transport  ] [qIMyueh] exception caught on transport layer [[id: 0x294d028e, L:/127.0.0.1:63448 - R:/127.0.0.1:9300]], closing connection
io.netty.handler.codec.DecoderException: java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:442) ~[netty-codec-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248) ~[netty-codec-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:373) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:351) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:373) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:651) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:536) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:490) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:450) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873) [netty-common-4.1.6.Final.jar:4.1.6.Final]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
Caused by: java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50)
        at org.elasticsearch.transport.TcpTransport.validateMessageHeader(TcpTransport.java:1140) ~[elasticsearch-5.1.2.jar:5.1.2]
        at org.elasticsearch.transport.netty4.Netty4SizeHeaderFrameDecoder.decode(Netty4SizeHeaderFrameDecoder.java:36) ~[?:?]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411) ~[?:?]
        ... 15 more

 

 

 

一开始以为是 es版本过高或jdk版本过低(我的是jdk8),换了低版本的es(5.1)还是这个错误,最终发现好像是9300这个端口被占用,于是用  netstat -ano | findstr "9300"

发现是system的东西在占用,最终在config/elasticsearch.yml文件中添加这个,进行tcp内部通信的端口修改

elasticsearch-windows启动时的问题

报错后启动正常,但是在浏览器打开localhost:9200后发现还是不行,查看启动日志发现

[2021-03-14T09:00:02,244][INFO ][o.e.t.TransportService   ] [qIMyueh] publish_address {127.0.0.1:9305}, bound_addresses {127.0.0.1:9305}, {[::1]:9305}
[2021-03-14T09:00:05,295][INFO ][o.e.c.s.ClusterService   ] [qIMyueh] new_master {qIMyueh}{qIMyueh2RgSoTP9vXfYmGg}{mckMgDUER5WPf-NXwoDgrQ}{127.0.0.1}{127.0.0.1:9305}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2021-03-14T09:00:05,331][INFO ][o.e.g.GatewayService     ] [qIMyueh] recovered [0] indices into cluster_state
[2021-03-14T09:00:05,916][INFO ][o.e.h.HttpServer         ] [qIMyueh] publish_address {127.0.0.1:9203}, bound_addresses {127.0.0.1:9203}, {[::1]:9203}
[2021-03-14T09:00:05,916][INFO ][o.e.n.Node               ] [qIMyueh] started

 

http的监听端口已经成为了9203了,换成了localhost:9203 一切正常

elasticsearch-windows启动时的问题

 

elasticsearch-windows启动时的问题

上一篇:.Net Core Web API 服务器搭建和自定义IP和端口


下一篇:解决Windows 10 Tomcat命令行窗口中文乱码