ElasticSearch 中的多个节点 [英] Multiple nodes in ElasticSearch
问题描述
如何在我的 ElasticSearch 中拥有多个节点?我在 elasticsearch.yml 中使用以下内容,但只有最后一个节点启动,并且浏览器抱怨:file://localhost/处的页面说:undefined
.
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
推荐答案
我认为最简单的方法是在命令行中指定这些参数.要启动三个节点,您只需要在 elasticsearch 主目录中运行以下三个命令:
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
另一种解决方案是创建 3 个不同的配置文件并使用 -Des.config=path-to-config-file
参数启动三个节点.
Another solution is to create 3 different config files and start three nodes with -Des.config=path-to-config-file
parameter.
这篇关于ElasticSearch 中的多个节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!