ElasticSearch启动时绑定端口失败

ElasticSearch启动时绑定端口失败

问题

我下载了elasticSearch的zip文件,解压到了相应的文件文件夹内,然后进入工程的bin文件夹,打开cmd执行elasticsearch命令之后,控制台就报错了,详细报错如下:

D:\elasticsearch-7.0.0\bin>elasticsearch
[2019-06-30T22:21:26,541][INFO ][o.e.e.NodeEnvironment    ] [DESKTOP-OJFGS9E] using [1] data paths, mounts [[鏂板姞鍗?(D:)]], net usable_space [71.6gb], net total_space [78.8gb], types [NTFS]

[2019-06-30T22:21:26,548][INFO ][o.e.e.NodeEnvironment    ] [DESKTOP-OJFGS9E] heap size [990.7mb], compressed ordinary object pointers [true]
[2019-06-30T22:21:26,563][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] node name [DESKTOP-OJFGS9E], node ID [SpsiDM4yTIWn8jfxY2n0qg]
[2019-06-30T22:21:26,565][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] version[7.0.0], pid[5524], build[default/zip/b7e28a7/2019-04-05T22:55:32.697037Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_201/25.201-b09]
[2019-06-30T22:21:26,570][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] JVM home [D:\Program Files\Java\jdk1.8.0_201\jre]
[2019-06-30T22:21:26,573][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=C:\Users\guanjie\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Dio.netty.allocator.type=unpooled, -Delasticsearch, -Des.path.home=D:\elasticsearch-7.0.0, -Des.path.conf=D:\elasticsearch-7.0.0\config, -Des.distribution.flavor=default, -Des.distribution.type=zip, -Des.bundled_jd=true]
[2019-06-30T22:21:31,586][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [aggs-matrix-stats]
[2019-06-30T22:21:31,586][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [analysis-common]
[2019-06-30T22:21:31,587][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [ingest-common]
[2019-06-30T22:21:31,587][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [ingest-geoip]
[2019-06-30T22:21:31,587][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [ingest-user-agent]
[2019-06-30T22:21:31,588][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [lang-expression]
[2019-06-30T22:21:31,589][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [lang-mustache]
[2019-06-30T22:21:31,590][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [lang-painless]
[2019-06-30T22:21:31,590][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [mapper-extras]
[2019-06-30T22:21:31,592][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [parent-join]
[2019-06-30T22:21:31,593][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [percolator]
[2019-06-30T22:21:31,594][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [rank-eval]
[2019-06-30T22:21:31,594][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [reindex]
[2019-06-30T22:21:31,595][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [repository-url]
[2019-06-30T22:21:31,597][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [transport-netty4]
[2019-06-30T22:21:31,598][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-ccr]
[2019-06-30T22:21:31,599][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-core]
[2019-06-30T22:21:31,599][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-deprecation]
[2019-06-30T22:21:31,600][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-graph]
[2019-06-30T22:21:31,602][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-ilm]
[2019-06-30T22:21:31,603][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-logstash]
[2019-06-30T22:21:31,603][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-ml]
[2019-06-30T22:21:31,604][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-monitoring]
[2019-06-30T22:21:31,605][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-rollup]
[2019-06-30T22:21:31,609][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-security]
[2019-06-30T22:21:31,609][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-sql]
[2019-06-30T22:21:31,611][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] loaded module [x-pack-watcher]
[2019-06-30T22:21:31,613][INFO ][o.e.p.PluginsService     ] [DESKTOP-OJFGS9E] no plugins loaded
[2019-06-30T22:21:43,815][INFO ][o.e.x.s.a.s.FileRolesStore] [DESKTOP-OJFGS9E] parsed [0] roles from file [D:\elasticsearch-7.0.0\config\roles.yml]
[2019-06-30T22:21:45,937][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [DESKTOP-OJFGS9E] [controller/9936] [Main.cc@109] controller (64 bit): Version 7.0.0 (Build cdaa022645f38d) Copyright (c) 2019 Elasticsearch BV
[2019-06-30T22:21:46,725][DEBUG][o.e.a.ActionModule       ] [DESKTOP-OJFGS9E] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-06-30T22:21:47,216][INFO ][o.e.d.DiscoveryModule    ] [DESKTOP-OJFGS9E] using discovery type [zen] and seed hosts providers [settings]
[2019-06-30T22:21:48,681][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] initialized
[2019-06-30T22:21:48,682][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] starting ...
[2019-06-30T22:21:50,609][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [DESKTOP-OJFGS9E] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300-9400]]; nested: BindException[Cannot assign requested address: bind];
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-7.0.0.jar:7.0.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.0.0.jar:7.0.0]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to [9300-9400]
        at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:408) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:375) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:136) ~[?:?]
        at org.elasticsearch.xpack.core.security.transport.netty4.SecurityNetty4Transport.doStart(SecurityNetty4Transport.java:107) ~[?:?]
        at org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4ServerTransport.doStart(SecurityNetty4ServerTransport.java:43) ~[?:?]
        at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:61) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.transport.TransportService.doStart(TransportService.java:228) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:61) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.node.Node.start(Node.java:662) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:263) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:334) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.0.0.jar:7.0.0]
        ... 6 more
Caused by: java.net.BindException: Cannot assign requested address: bind
        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 io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:130) ~[?:?]
        at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:562) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1358) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:1019) ~[?:?]
        at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:258) ~[?:?]
        at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366) ~[?:?]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) ~[?:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:474) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909) ~[?:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
[2019-06-30T22:21:50,621][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] stopping ...
[2019-06-30T22:21:50,627][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] stopped
[2019-06-30T22:21:50,628][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] closing ...
[2019-06-30T22:21:50,653][INFO ][o.e.n.Node               ] [DESKTOP-OJFGS9E] closed

原因

看到这个有可能第一反应是自己的权限不够,或者端口被占用什么的。不过我查看可这另个,确定没有问题。
从这个上面来看,应该是和自己的ip和端口的配置有关系,于是我打开配置yml文件配置文件查看了一下ip和端口的配置。发现是自己的network.host配置错了。

解决

使用ipconfig命令查看自己电脑的ip地址,修改network.host的值。

上网搜索有人说这一下不能设置为自己的主机名。我感觉也是,因为这个命令上面有一个配置说明,如下:

#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.1.104

意思就是这个参数要制定IPV4或者IPV6地址,也就是说要写IP地址。但是具体能不能使用主机名我没有验证。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值