Multiple nodes in ElasticSearch

前端 未结 4 436
长情又很酷
长情又很酷 2020-12-07 23:37

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

相关标签:
4条回答
  • 2020-12-07 23:45

    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
    
    0 讨论(0)
  • 2020-12-07 23:48

    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
    
    0 讨论(0)
  • 2020-12-08 00:05

    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.

    0 讨论(0)
  • 2020-12-08 00:11

    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?

    0 讨论(0)
提交回复
热议问题