How to config Single node for Single Cluster (Stan

2020-05-14 03:33发布

I installed elastic search in my local machine, I want to configure it as the only one single node in the cluster(Standalone Server). it means whenever I create a new index, it will only available to my server. It will not be accessible to other's server.

My current scenario these indexes are available to other servers (the servers are formed in a cluster), and they can make any changes to my indexes. But I don't want it.

I went through some other blogs but not getting best solution. So can you please let me know steps for same?

9条回答
爷、活的狠高调
2楼-- · 2020-05-14 04:07

I ve got the answer from http://elasticsearch-users.115913.n3.nabble.com/How-to-isolate-elastic-search-node-from-other-nodes-td3977389.html.

Kimchy : You set the node to local(true), this means it will not discover other nodes using network, only within the same JVM.

in elasticsearch/bin/elasticsearch.yml file

node.local: true # disable network
查看更多
smile是对你的礼貌
3楼-- · 2020-05-14 04:15

In the config file, add:

  • network.host: 0.0.0.0 [in Network settings]
  • discovery.type: single-node [in Discovery and Cluster formation settings]
查看更多
Evening l夕情丶
4楼-- · 2020-05-14 04:18

If you intend to run Elasticseach on a Single Node and be able to bind it to public IP, two important settings are:

network.host: <PRIVATE IP OF HOST>
discovery.type: single-node
查看更多
Explosion°爆炸
5楼-- · 2020-05-14 04:18

All of these didn´t help me (and I sadly didn´t read the answer of bhdrkn). The thing that worked for me was to change elasticsearch´s cluster-name everytime I need to have a separate instance, where new nodes aren´t added automatically via multicast.

Just change cluster.name: {{ elasticsearch.clustername }} in elasticsearch.yml, e.g. via Ansible. This is particulary helpful, when building separate Stages like Dev, QA and Production (which is a standard usecase in enterprise-environments).

And if you´re using logstash to get your data into elasticsearch, don´t forget to put the same cluster-name into the output-section, like:

output {
    elasticsearch {
        cluster => "{{ elasticsearch.clustername }}"
    }
}

Otherwise your "logstash-*"-index will not be build correctly...

查看更多
成全新的幸福
6楼-- · 2020-05-14 04:19

In 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

Use the same configuration in your code.

Also to isolate the node use node.local: true or discovery.zen.ping.multicast: false

查看更多
再贱就再见
7楼-- · 2020-05-14 04:22

I wanted to do this without having to write/overwrite an elasticsearch.yml in my container. Here it is without a config file

Set an environment variable prior to starting elasticsearch:

discovery.type=single-node

https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html

查看更多
登录 后发表回答