Search code examples
elasticsearchelastic-stackelkefk

How to configure discovery.type in elasticsearch?


I have a Kubernetes cluster with 2 nodes on which I'm running EFK stack (es + fluentd + kibana), flunetd is running on a daemonset, which means it runs two pods, one on each node.

However, I want to know how to configure discovery.type for es which I set to singleNode. In other words, does it depend on the number of my cluster nodes or not, and should I run multiple replicas of es?


Solution

  • If you are running a single node of Elasticsearch, then you need to set discovery.type to single-node, more info on this official doc and in this SO answer.

    Coming to the replica part, yeah you should always have at least 1 replica of your every index in the cluster for high availability reason when primary shard goes down, still, as copy is available in form of replica your index will be functional and replica shard will be marked as primary shard and when nodes on which earlier primary shard was present or another node joins the cluster, a replica will be assigned. without replica shard, your elasticsearch cluster will be in Yellow state.

    More info on cluster health.