如何为单个群集(独立群集)配置单个节点ElasticSearch
我在本地计算机中安装了弹性搜索,我想将其配置为群集中唯一的一个单独节点(独立服务器)。这意味着每当我创建一个新的索引时,它只会对我的服务器有效。它不会被其他服务器访问。如何为单个群集(独立群集)配置单个节点ElasticSearch
我当前的场景这些索引可用于其他服务器(服务器形成一个集群),他们可以对我的索引进行任何更改。但我不想要它。
我经历了一些其他的博客,但没有得到最好的解决方案。那么你能让我知道相同的步骤吗?
我从http://elasticsearch-users.115913.n3.nabble.com/How-to-isolate-elastic-search-node-from-other-nodes-td3977389.html得到了答案。 Kimchy:您将节点设置为本地(true),这意味着它不会使用网络发现其他节点,只会在相同的JVM中发现。
在elasticsearch /斌/ elasticsearch.yml文件node.local: true # disable network
这是官方参考文献中的任何地方吗? – tuespetre 2015-02-11 17:58:50
它没有记录,就像elasticsearch“功能”的一半 – 2016-10-19 08:51:46
'node.local'已被弃用。请参阅下面的@ felix-borzik答案。 – jevonearth 2017-11-10 17:34:10
如果您使用代码中的网络传输,这是不行的,因为node.local
给你只是一个LocalTransport:
然后诀窍是设置
discovery.zen.ping.multicast: false
在您的elasticsearch.yml
这将停止您的节点寻找任何其他节点。
我不知道,如果这可以防止其他节点发现,虽然你;我只需要在同一网络上使用相同的设置来影响一组节点。
无法在ElasticSearch 5上工作。 – iceberg 2017-05-12 14:13:40
请参阅[本答复](https://*.com/a/45263329/368683)ElasticSearch 5.0及更高版本。 – user368683 2018-02-24 08:59:03
在elasticsearch.yml
# Note, that for development on a local machine, with small indices, it usually
# makes sense to "disable" the distributed features:
#
index.number_of_shards: 1
index.number_of_replicas: 0
使用相同的配置在你的代码。
而且孤立节点使用node.local: true
或discovery.zen.ping.multicast: false
在ElasticSearch 5上不起作用。 – Raptor 2017-01-23 04:40:34
请参阅[此响应](ElasticSearch 5.0及更高版本)(https://*.com/a/45263329/368683)。 – user368683 2018-02-24 08:59:41
所有这些didn't帮助我(和我黯然didn't读bhdrkn的答案)。这对我来说很有用,那就是每次我需要一个单独的实例时,都会改变elasticsearch的集群名称,其中新节点不会通过多播自动添加。
只需在elasticsearch.yml中更改cluster.name:{{elasticsearch.clustername}},例如通过Ansible。当构建Dev,QA和Production(这是企业环境中的标准用例)等单独阶段时,这非常有帮助。
如果you're使用logstash,让您的数据转换成elasticsearch,不要忘了把同样的集群名称到输出部分,如:
output {
elasticsearch {
cluster => "{{ elasticsearch.clustername }}"
}
}
否则你的“logstash- * “-index将无法正确构建...
下面是ElasticSearch 5相关信息:
据changelog,来启用ES 5本地模式需要添加transport.type: local
您elasticsearch.yml
而不是node.local: true
。
这需要进行表决。 – jevonearth 2017-11-10 17:32:56
这个回应对我有用。请注意,一些较旧的答案可能已过时。 以下是上述[changelog](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking_50_settings_changes.html#_node_settings)的工作链接。 – user368683 2018-02-24 08:57:03
或者,您可以更改服务器的群集名称。 – bhdrkn 2015-04-28 07:11:05