Not to able to create new node

Hello Elastic Members,

ES Version: 7.12.0
OS: Windows 10

I am following an udemy course on ES. The trainer has given a task to add an additional node to the cluster(contains only 1 node) that runs on a same machine.

So, downloaded the zip file of ES again and stored it in different directory. And in the terminal window, ran the batch file after configuring node.name: node-2 in the yml file.

But it ran into error stating that it failed to obtain node locks, tried [[C:\ProgramData\Elastic\Elasticsearch\data]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?

Below is the log.

[2021-04-28T21:03:23,062][INFO ][o.e.p.PluginsService ] [CJB10-CG8441379] no plugins loaded
[2021-04-28T21:03:23,661][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [CJB10-CG8441379] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[C:\ProgramData\Elastic\Elasticsearch\data]] 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:163) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116) ~[elasticsearch-cli-7.12.1.jar:7.12.1]
at org.elasticsearch.cli.Command.main(Command.java:79) ~[elasticsearch-cli-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81) ~[elasticsearch-7.12.1.jar:7.12.1]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[C:\ProgramData\Elastic\Elasticsearch\data]] 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.env.NodeEnvironment.(NodeEnvironment.java:292) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.node.Node.(Node.java:352) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.node.Node.(Node.java:278) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:217) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:217) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:397) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.12.1.jar:7.12.1]
... 6 more
uncaught exception in thread [main]
java.lang.IllegalStateException: failed to obtain node locks, tried [[C:\ProgramData\Elastic\Elasticsearch\data]] 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.env.NodeEnvironment.(NodeEnvironment.java:292)
at org.elasticsearch.node.Node.(Node.java:352)
at org.elasticsearch.node.Node.(Node.java:278)
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:217)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:217)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:397)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116)
at org.elasticsearch.cli.Command.main(Command.java:79)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81)
For complete error details, refer to the log at C:\ProgramData\Elastic\Elasticsearch\logs\elasticsearch.log

Upon googling out, it says that I need to configure node.max_local_storage_nodes in elasticsearch.yml to a value larger than 1.

I am an absolute begginer, don't know how to set up that. If someone could help me on this, I'd really appreciate that.

Thanks in advance

Please format your code/logs/config using the </> button, or markdown style back ticks. It helps to make things easy to read which helps us help you :slight_smile:

That goes in your elasticsearch.yml, where you set the node.name: node-2.

Hi Mark,

Thanks for your reply. Going forward, will make sure I use </>. The terminal throws up the same error even after configuring node.max_local_storage_nodes:2 in the node.name: node-2 file

</

======================== Elasticsearch Configuration =========================

NOTE: Elasticsearch comes with reasonable defaults for most settings.

Before you set out to tweak and tune the configuration, make sure you

understand what are you trying to accomplish and the consequences.

The primary way of configuring a node is via this file. This template lists

the most important settings you may want to configure for a production cluster.

Please consult the documentation for further information on configuration options:

Elasticsearch Guide | Elastic

---------------------------------- Cluster -----------------------------------

Use a descriptive name for your cluster:

#cluster.name: my-application

------------------------------------ Node ------------------------------------

Use a descriptive name for the node:

node.name: node-2

Add custom attributes to the node:

#node.attr.rack: r1

----------------------------------- Paths ------------------------------------

Path to directory where to store the data (separate multiple locations by comma):

#path.data: /path/to/data

Path to log files:

#path.logs: /path/to/logs

----------------------------------- Memory -----------------------------------

Lock the memory on startup:

#bootstrap.memory_lock: true

Make sure that the heap size is set to about half the memory available

on the system and that the owner of the process is allowed to use this

limit.

Elasticsearch performs poorly when the system is swapping the memory.

---------------------------------- 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.

--------------------------------- Discovery ----------------------------------

Pass an initial list of hosts to perform discovery when this node is started:

The default list of hosts is ["127.0.0.1", "[::1]"]

#discovery.seed_hosts: ["host1", "host2"]

Bootstrap the cluster using an initial set of master-eligible nodes:

#cluster.initial_master_nodes: ["node-1", "node-2"]

For more information, consult the discovery and cluster formation module documentation.

---------------------------------- Various -----------------------------------

Require explicit names when deleting indices:

#action.destructive_requires_name: true

node.max_local_storage_nodes:2

The above method didn't work as expected. So I tried creating an additional node using the same directory. I ran the below command.
C:\Program Files\Elastic\Elasticsearch\7.12.0>bin\elasticsearch -Enode.name=node-2 -Epath.data=./node-2/data -Epath.logs=./node-2/logs
But, this as well gave the following error.

</C:\Program Files\Elastic\Elasticsearch\7.12.0>bin\elasticsearch -Enode.name=node-2 -Epath.data=./node-2/data -Epath.logs=./node-2/logs
Could not rename log file 'logs/gc.log' to 'logs/gc.log.30' (Permission denied).
[2021-04-29T16:51:55,902][INFO ][o.e.n.Node ] [node-2] version[7.12.0], pid[15924], build[unknown/unknown/78722783c38caa25a70982b5b042074cde5d3b3a/2021-03-18T06:17:15.410153305Z], OS[Windows 10/10.0/amd64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/15.0.1/15.0.1+9]
[2021-04-29T16:51:55,905][INFO ][o.e.n.Node ] [node-2] JVM home [C:\Program Files\Elastic\Elasticsearch\7.12.0\jdk]
[2021-04-29T16:51:55,907][INFO ][o.e.n.Node ] [node-2] JVM arguments [-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, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=C:\Users\hussshe\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Xmx2560m, -Xms2560m, -XX:MaxDirectMemorySize=1342177280, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Delasticsearch, -Des.path.home=C:\Program Files\Elastic\Elasticsearch\7.12.0, -Des.path.conf=C:\ProgramData\Elastic\Elasticsearch\config]
[2021-04-29T16:52:03,031][INFO ][o.e.p.PluginsService ] [node-2] loaded module [aggs-matrix-stats]
[2021-04-29T16:52:03,032][INFO ][o.e.p.PluginsService ] [node-2] loaded module [analysis-common]

[2021-04-29T16:52:03,537][INFO ][o.e.e.NodeEnvironment ] [node-2] using [1] data paths, mounts [[OSDisk (C:)]], net usable_space [54.1gb], net total_space [236.8gb], types [NTFS]
[2021-04-29T16:52:03,538][INFO ][o.e.e.NodeEnvironment ] [node-2] heap size [2.5gb], compressed ordinary object pointers [true]
[2021-04-29T16:52:03,657][INFO ][o.e.n.Node ] [node-2] node name [node-2], node ID [vEJLD-ONRaq_q6LB75WTxw], cluster name [elasticsearch], roles [transform, data_frozen, master, remote_cluster_client, data, ml, data_content, data_hot, data_warm, data_cold, ingest]
[2021-04-29T16:52:08,456][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [node-2] [controller/11896] [Main.cc@117] controller (64 bit): Version 7.12.0 (Build 778cc7261dfdd1) Copyright (c) 2021 Elasticsearch BV
[2021-04-29T16:52:08,991][INFO ][o.e.x.s.a.s.FileRolesStore] [node-2] parsed [0] roles from file [C:\ProgramData\Elastic\Elasticsearch\config\roles.yml]
[2021-04-29T16:52:10,394][INFO ][o.e.t.NettyAllocator ] [node-2] creating NettyAllocator with the following configs: [name=elasticsearch_configured, chunk_size=1mb, suggested_max_allocation_size=1mb, factors={es.unsafe.use_netty_default_chunk_and_page_size=false, g1gc_enabled=true, g1gc_region_size=4mb}]
[2021-04-29T16:52:10,475][INFO ][o.e.d.DiscoveryModule ] [node-2] using discovery type [zen] and seed hosts providers [settings]
[2021-04-29T16:52:10,997][INFO ][o.e.g.DanglingIndicesState] [node-2] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually
[2021-04-29T16:52:11,473][INFO ][o.e.n.Node ] [node-2] initialized
[2021-04-29T16:52:11,474][INFO ][o.e.n.Node ] [node-2] starting ...
[2021-04-29T16:52:11,487][INFO ][o.e.x.s.c.PersistentCache] [node-2] persistent cache index loaded
[2021-04-29T16:52:11,743uncaught exception in thread [main]
][ERRORBindTransportException[Failed to bind to 127.0.0.1:9300]; nested: BindException[Address already in use: bind];
][Likely root cause: java.net.BindException: Address already in use: bind
o.e.b.ElasticsearchUncaughtExceptionHandler] at java.base/sun.nio.ch.Net.bind0(Native Method)
[node-2 at java.base/sun.nio.ch.Net.bind(Net.java:550)
] uncaught exception in thread at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:249)
[main at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134)
]
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:550)
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to 127.0.0.1:9300]; nested: BindException[Address already in use: bind];
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.12.0.jar:7.12.0]
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116) ~[elasticsearch-cli-7.12.0.jar:7.12.0]
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506)
at org.elasticsearch.cli.Command.main(Command.java:79) ~[elasticsearch-cli-7.12.0.jar:7.12.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.12.0.jar:7.12.0]
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81) ~[elasticsearch-7.12.0.jar:7.12.0]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to 127.0.0.1:9300
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:406) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:370) ~[elasticsearch-7.12.0.jar:7.12.0]
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:248)
at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:120) ~[?:?]
at org.elasticsearch.xpack.core.security.transport.netty4.SecurityNetty4Transport.doStart(SecurityNetty4Transport.java:85) ~[?:?]
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
at org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4ServerTransport.doStart(SecurityNetty4ServerTransport.java:47) ~[?:?]
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:48) ~[elasticsearch-7.12.0.jar:7.12.0]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at org.elasticsearch.transport.TransportService.doStart(TransportService.java:263) ~[elasticsearch-7.12.0.jar:7.12.0]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:48) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.node.Node.start(Node.java:827) ~[elasticsearch-7.12.0.jar:7.12.0]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:311) ~[elasticsearch-7.12.0.jar:7.12.0]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:406) ~[elasticsearch-7.12.0.jar:7.12.0]
at java.base/java.lang.Thread.run(Thread.java:832)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.12.0.jar:7.12.0]
... 6 more
For complete error details, refer to the log at C:\Program Files\Elastic\Elasticsearch\7.12.0\node-2\logs\elasticsearch.log
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
at sun.nio.ch.Net.bind(Net.java:550) ~[?:?]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:249) ~[?:?]
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:832) [?:?]
[2021-04-29T16:52:12,524][INFO ][o.e.n.Node ] [node-2] stopping ...
[2021-04-29T16:52:12,529][INFO ][o.e.n.Node ] [node-2] stopped
[2021-04-29T16:52:12,530][INFO ][o.e.n.Node ] [node-2] closing ...
[2021-04-29T16:52:12,544][INFO ][o.e.n.Node ] [node-2] closed

  1. Please format your code.
  2. Failed to bind to 127.0.0.1:9300 seems to be your problem — you'll need to configure different ports for transport.port so they don't collide.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.