Michael
Michael

Reputation: 14218

Multiple nodes in ElasticSearch

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

Upvotes: 20

Views: 28338

Answers (4)

VladOhotnikov
VladOhotnikov

Reputation: 1188

In windows for 6.x version, command attributes change to

elasticsearch -EsomeYamlPropety=someValue

First You need change an elasticsearch.yml properties to:

http.port: 9200-9299
transport.tcp.port: 9300-9399
node.max_local_storage_nodes: 2

Because You cant run nodes on single port, and when I try to use command with argument -Ehttp.port=9201 nodes where cant see each other and they create two different clusters with the same name.

Run the first node by a standard command:

.\bin\elasticsearch

Run the second node by command with attributes:

.\bin\elasticsearch -Enode.name=NodeTwo -Enode.master=false

Upvotes: 2

siawash
siawash

Reputation: 11

for running 3 elasticsearch node on one machine, you should use these configs in elasticsearch.yml file of each node:

for master node :

cluster.name: mycluster
node.name: "node1"
node.master: true
node.data: true
network.host: 127.0.0.1
http.port: 9200-9299
transport.tcp.port: 9300-9399
discovery.zen.minimum_master_nodes: 2

for data nodes :

cluster.name: mycluster
node.name: "data-node-name"
node.master: false
node.data: true
network.host: 127.0.0.1
http.port: 9200-9299
transport.tcp.port: 9300-9399
discovery.zen.minimum_master_nodes: 2

and then u should run each node by :

cd path/to/elasticsearch/bin
path\bin>elasticsearch.bat

Upvotes: 1

Paul Sanwald
Paul Sanwald

Reputation: 11329

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?

Upvotes: 2

imotov
imotov

Reputation: 30153

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.

Upvotes: 36

Related Questions