Search code examples
elasticsearch

getting error " failed to obtain node locks, tried " when starting second node in elastic search


I am just a beginner in learning elastic search and started to setup 2 node cluster on windows 10 box.

I have configured the two nodes based on the forums and articles.

However, I am able to start the first node but when starting the second node, it throws an error.

[2018-11-05T16:07:31,935][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [elastic_search_node_02] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[C:\Elastic_search_cluster\data\elastic_search_cluster]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?

The following is the setup for both the nodes,

Node 1 dir

C:\Elastic_search_cluster\elasticsearch-6.4.2_node01\

Node 2 dir

C:\Elastic_search_cluster\elasticsearch-6.4.2_node02\

Data folder

C:\Elastic_search_cluster\data\

Logs folder

C:\Elastic_search_cluster\logs\

Node 1 configuration

cluster.name: elastic_search_cluster
node.name: elastic_search_node_01
node.master: true
node.data: true
path.data: C:\Elastic_search_cluster\data\
path.logs: C:\Elastic_search_cluster\logs\
network.host: localhost
http.port: 9200

Node 2 configuration

cluster.name: elastic_search_cluster
node.name: elastic_search_node_02
node.master: false
node.data: true
path.data: C:\Elastic_search_cluster\data\
path.logs: C:\Elastic_search_cluster\logs\
network.host: localhost
http.port: 9201

Please advise on the configuration or any other recommendation. Does the data and logs folder path need to be separate for each node.

Do i need to set other parameters like the below ?

discovery.zen.ping.unicast.hosts:
discovery.zen.minimum_master_nodes: 

Solution

  • Make sure node.max_local_storage_nodes param is set to # of nodes in cluster locally ( In your case 2 ) . I notice that you already have node names different.

    in yaml ,

    node.max_local_storage_nodes: 2