Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple nodes in ElasticSearch

Tags:

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
like image 270
Michael Avatar asked Nov 20 '12 16:11

Michael


People also ask

How do I make multiple nodes in Elasticsearch?

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.

Can I run multiple Elasticsearch nodes on the same machine?

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.

How many Elasticsearch nodes do I need?

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.


2 Answers

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.

like image 95
imotov Avatar answered Oct 21 '22 03:10

imotov


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?

like image 23
Paul Sanwald Avatar answered Oct 21 '22 01:10

Paul Sanwald