How can I have multiple nodes in my ElasticSearch? I'm using the following in elasticsearch.yml but only the last node starts, and the browser complains: The page at file://localhost/ says: undefined
.
node.name: "No Data"
node.master: true
node.data: false
node.name: "Data One"
node.master: false
node.data: true
node.name: "Data Two"
node.master: false
node.data: true
To enroll new nodes in your cluster, create an enrollment token with the elasticsearch-create-enrollment-token tool on any existing node in your cluster. You can then start a new node with the --enrollment-token parameter so that it joins an existing cluster.
In this case is better to have a larger node instance. But to run multiple nodes in the same hosts you need to have a different elasticsearch. yml for every node with separated data and log folders, there isn't a way to use the same elasticsearch. yml to run multiple nodes at the same time.
To start, we recommend a minimum of three nodes to avoid potential OpenSearch issues, such as split brain (when a lapse in communication leads to a cluster having two master nodes). If you have three dedicated master nodes, we still recommend a minimum of two data nodes for replication.
I think the simplest way to do it is by specifying these parameters on the command line. To start three nodes you just need to run the following three commands in elasticsearch home directory:
$ bin/elasticsearch -Des.node.data=false -Des.node.master=true -Des.node.name=NoData
$ bin/elasticsearch -Des.node.data=true -Des.node.master=false -Des.node.name=DataOne
$ bin/elasticsearch -Des.node.data=true -Des.node.master=false -Des.node.name=DataTwo
Another solution is to create 3 different config files and start three nodes with -Des.config=path-to-config-file
parameter.
First off, you should be trying to access elasticsearch using
[http://localhost:9200/][1]
, if you are using the default port bindings.
I would set up your master node to also be a data node, there is no reason not to. If you are trying to start 3 nodes on a single machine. But, starting 3 nodes all on the same machine doesn't make sense as anything other than an experiment. What are you trying to accomplish?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With