elasticsearch

es启动报错BindException: Can't assig

2021-07-07  本文已影响0人  Geroge1226

1. 现象

mac上启动es报如下错误:BindException[Can't assign requested address]; Likely root cause: java.net.BindException: Can't assign requested address

[2021-07-07T15:29:14,721][INFO ][o.e.x.s.c.f.PersistentCache] [lsyPro] persistent cache index loaded
[2021-07-07T15:29:14,882][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [lsyPro] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to 192.168.0.1:[9300-9400]]; nested: BindException[Can't assign requested address];
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116) ~[elasticsearch-cli-7.13.0.jar:7.13.0]
    at org.elasticsearch.cli.Command.main(Command.java:79) ~[elasticsearch-cli-7.13.0.jar:7.13.0]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81) ~[elasticsearch-7.13.0.jar:7.13.0]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to 192.168.0.1:[9300-9400]
    at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:406) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:370) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:120) ~[?:?]
    at org.elasticsearch.xpack.core.security.transport.netty4.SecurityNetty4Transport.doStart(SecurityNetty4Transport.java:85) ~[?:?]
    at org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4ServerTransport.doStart(SecurityNetty4ServerTransport.java:47) ~[?:?]
    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:48) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.transport.TransportService.doStart(TransportService.java:263) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:48) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.node.Node.start(Node.java:865) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:311) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:406) ~[elasticsearch-7.13.0.jar:7.13.0]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.13.0.jar:7.13.0]
    ... 6 more
Caused by: java.net.BindException: Can't assign requested address
    at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
    at sun.nio.ch.Net.bind(Net.java:552) ~[?:?]
    at sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:336) ~[?:?]
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294) ~[?:?]
    at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134) ~[?:?]
    at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:550) ~[?:?]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334) ~[?:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506) ~[?:?]
    at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491) ~[?:?]
    at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973) ~[?:?]
    at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:248) ~[?:?]
    at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356) ~[?:?]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[?:?]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) ~[?:?]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[?:?]
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[?:?]
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[?:?]
    at java.lang.Thread.run(Thread.java:831) [?:?]
uncaught exception in thread [main]
BindTransportException[Failed to bind to 192.168.0.1:[9300-9400]]; nested: BindException[Can't assign requested address];
Likely root cause: java.net.BindException: Can't assign requested address
    at java.base/sun.nio.ch.Net.bind0(Native Method)
    at java.base/sun.nio.ch.Net.bind(Net.java:552)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:336)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
    at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:550)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
    at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506)
    at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491)
    at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
    at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:248)
    at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at java.base/java.lang.Thread.run(Thread.java:831)
For complete error details, refer to the log at /usr/local/var/log/elasticsearch/elasticsearch_longshiyang.log
[2021-07-07T15:29:15,747][INFO ][o.e.n.Node               ] [lsyPro] stopping ...
[2021-07-07T15:29:15,752][INFO ][o.e.n.Node               ] [lsyPro] stopped
[2021-07-07T15:29:15,752][INFO ][o.e.n.Node               ] [lsyPro] closing ...
[2021-07-07T15:29:15,760][INFO ][o.e.n.Node               ] [lsyPro] closed
[2021-07-07T15:29:15,762][INFO ][o.e.x.m.p.NativeController] [lsyPro] Native controller process has stopped - no new native processes can be started

2、原因

从错误日志看...BindException,Can't assign requested address.., 是启动时候无法使用端口或者IP,查看端口占用情况:lsof -i:9200 端口未被使用,

3、解决方式

打开es配置文件elasticsearch.yml, 目录 /usr/local/etc/elasticsearch

# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 192.168.0.1
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#

使用的ip:192.168.0.1 改为127.0.0.1重启服务问题解决。

上一篇下一篇

猜你喜欢

热点阅读