ElasticSearch - 尝试在Windows上启动服务时出错

时间:2017-07-27 14:59:20

标签: elasticsearch

昨天,我在Windows Server 2012 R2上完成了ElasticSearch的安装,并且无法启动ElasticSearch服务。

今天,我安装了Kibana和X-Pack,现在尝试启动ElasticSearch服务时遇到错误。

C:\Program Files\Elastic\Elasticsearch\bin>elasticsearch
[2017-07-27T14:47:24,033][INFO ][o.e.n.Node               ] [VSMAIN-01] ini
tializing ...
[2017-07-27T14:47:24,080][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [V
S-SQL-MAIN-01] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: f
ailed to obtain node locks, tried [[F:\Elastic\Elasticsearch\Data\elasticsearch-
vd]] with lock id [0]; maybe these locations are not writable or multiple nodes
 were started without increasing [node.max_local_storage_nodes] (was [1])?
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127
) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:
114) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwar
eCommand.java:67) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:1
22) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5
.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
 ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)
 ~[elasticsearch-5.5.0.jar:5.5.0]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [
[F:\Elastic\Elasticsearch\Data\elasticsearch-vd]] with lock id [0]; maybe these
 locations are not writable or multiple nodes were started without increasing [n
ode.max_local_storage_nodes] (was [1])?
        at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:261
) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.node.Node.<init>(Node.java:264) ~[elasticsearch-5.5
.0.jar:5.5.0]
        at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5
.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[
elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[ela
sticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elas
ticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123
) ~[elasticsearch-5.5.0.jar:5.5.0]
        ... 6 more

我甚至不知道从哪里开始诊断这一点,并希望有人在Windows上体验ElasticSearch可以提供帮助。

目前正在运行Java 8.0.141。

任何建议都将不胜感激。

编辑#1:我应该说清楚我只有一个ES安装正在运行(试图运行!)我已经通过将node.max_local_storage_nodes增加到2来绕过上述错误。现在问题是新的错误,并且不鼓励增加最大本地存储节点。

以下是尝试启动ElasticSearch时出现的新错误:

C:\Program Files\Elastic\Elasticsearch\bin>elasticsearch
[2017-07-27T17:01:05,785][INFO ][o.e.n.Node               ] [VSMAIN-01] ini
tializing ...
[2017-07-27T17:01:05,863][INFO ][o.e.e.NodeEnvironment    ] [VSMAIN-01] usi
ng [1] data paths, mounts [[SQLVMDATA1 (F:)]], net usable_space [1.2tb], net tot
al_space [1.9tb], spins? [unknown], types [NTFS]
[2017-07-27T17:01:05,863][INFO ][o.e.e.NodeEnvironment    ] [VSMAIN-01] hea
p size [9.9gb], compressed ordinary object pointers [true]
[2017-07-27T17:01:05,863][INFO ][o.e.n.Node               ] [VSMAIN-01] nod
e name [VS-SQL-MAIN-01], node ID [d8V7e27_SzG4tPpUnVQEUg]
[2017-07-27T17:01:05,863][INFO ][o.e.n.Node               ] [VSMAIN-01] ver
sion[5.5.0], pid[5412], build[260387d/2017-06-30T23:16:05.735Z], OS[Windows Serv
er 2012 R2/6.3/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/
1.8.0_141/25.141-b15]
[2017-07-27T17:01:05,863][INFO ][o.e.n.Node               ] [VSMAIN-01] JVM
 arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:
+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -XX:+AlwaysPreTouch, -Xs
s1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io
.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySet
Optimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownH
ookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDu
mpOnOutOfMemoryError, -Xmx10240m, -Xms10240m, -Delasticsearch, -Des.path.home=C:
\Program Files\Elastic\Elasticsearch]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [aggs-matrix-stats]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [ingest-common]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [lang-expression]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [lang-groovy]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [lang-mustache]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [lang-painless]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [parent-join]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [percolator]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [reindex]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [transport-netty3]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] loa
ded module [transport-netty4]
[2017-07-27T17:01:06,677][INFO ][o.e.p.PluginsService     ] [VSMAIN-01] no
plugins loaded
[2017-07-27T17:01:08,099][INFO ][o.e.d.DiscoveryModule    ] [VSMAIN-01] usi
ng discovery type [zen]
[2017-07-27T17:01:08,537][INFO ][o.e.n.Node               ] [VSMAIN-01] ini
tialized
[2017-07-27T17:01:08,537][INFO ][o.e.n.Node               ] [VSMAIN-01] sta
rting ...
[2017-07-27T17:01:08,897][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [V
S-SQL-MAIN-01] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to b
ind to [9300]]; nested: BindException[Address already in use: bind];
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127
) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:
114) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwar
eCommand.java:67) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:1
22) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5
.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
 ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)
 ~[elasticsearch-5.5.0.jar:5.5.0]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to
 [9300]
        at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java
:793) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java
:758) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Tran
sport.java:173) ~[?:?]
        at org.elasticsearch.common.component.AbstractLifecycleComponent.start(A
bstractLifecycleComponent.java:69) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.transport.TransportService.doStart(TransportService
.java:209) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.common.component.AbstractLifecycleComponent.start(A
bstractLifecycleComponent.java:69) ~[elasticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.node.Node.start(Node.java:692) ~[elasticsearch-5.5.
0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:277) ~[ela
sticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:360) ~[elas
ticsearch-5.5.0.jar:5.5.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123
) ~[elasticsearch-5.5.0.jar:5.5.0]
        ... 6 more
Caused by: java.net.BindException: Address already in use: bind
        at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
        at sun.nio.ch.Net.bind(Unknown Source) ~[?:?]
        at sun.nio.ch.Net.bind(Unknown Source) ~[?:?]
        at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) ~[?:?]
        at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSo
cketChannel.java:128) ~[?:?]
        at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.
java:554) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChann
elPipeline.java:1258) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractCha
nnelHandlerContext.java:501) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHa
ndlerContext.java:486) ~[?:?]
        at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.j
ava:980) ~[?:?]
        at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:250) ~[?:?
]
        at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:365
) ~[?:?]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEv
entExecutor.java:163) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(Single
ThreadEventExecutor.java:403) ~[?:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThread
EventExecutor.java:858) ~[?:?]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_141]
[2017-07-27T17:01:09,631][INFO ][o.e.n.Node               ] [VSMAIN-01] sto
pping ...
[2017-07-27T17:01:09,631][INFO ][o.e.n.Node               ] [VSMAIN-01] sto
pped
[2017-07-27T17:01:09,631][INFO ][o.e.n.Node               ] [VSMAIN-01] clo
sing ...
[2017-07-27T17:01:09,631][INFO ][o.e.n.Node               ] [VSMAIN-01] clo
sed

4 个答案:

答案 0 :(得分:3)

从命令行

我也面临着同样的问题,我使用了以下步骤来摆脱它。

步骤1:检查默认的弹性搜索端口9300是否仍被占用

lsof -i:9300

是的,当时有人住了

步骤2:终止进程ID

杀死-9 38744

现在,很好启动了。

屏幕截图以供参考。

enter image description here

答案 1 :(得分:1)

问题解释为here

  

默认情况下,Elasticsearch配置为阻止多个节点共享同一数据路径。要允许多个节点(例如,在开发计算机上),请使用设置node.max_local_storage_nodes并将其设置为大于1的正整数。

如果在同一节点上运行多个ES安装并使用相同的数据文件夹进行配置,则需要更改某个ES服务器的数据路径,或者增加node.max_local_storage_nodes设置,但这是不鼓励的。

答案 2 :(得分:0)

这似乎是一个权限问题,日志说它无法获取节点锁。 这意味着它对您的文件夹F:\Elastic\Elasticsearch\Data\elasticsearch-vd没有写入权限。也就是说,我不是Windows上的ES专家。

祝你好运,IMO并不是那么可怕:)

答案 3 :(得分:0)

这对我有用(在Windows计算机上):

我打开了“任务管理器”,并禁用了另一个弹性搜索服务(可能是其他版本,或者是现有的进程ID)。

PS:当同一服务器/实例上已经有另一个弹性搜索服务正在运行时,似乎会出现此问题。