# Вопрос по дата нодам

**URL:** https://discuss.elastic.co/t/topic/323849
**Category:** Вопросы на русском языке
**Created:** [January 24, 2023, 3:08pm UTC](https://discuss.elastic.co/t/topic/323849 "2023-01-24T15:08:28Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![freeman999](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/freeman999/32/104827_2.png) [@freeman999](https://discuss.elastic.co/u/freeman999)
#### Post date: [January 24, 2023, 3:08pm UTC](https://discuss.elastic.co/t/topic/323849/1 "2023-01-24T15:08:28Z")

</div>

добрый день, я в данной теме новенький и хочу уточнить пару моментов:

1. правильно ли я понимаю что если у меня есть 2 дата ноды в кластере и каждый индекс имеем 1 праймери шард и один реплика шард то при выходе из строя любой дата ноды потери данных не произойдет ? т.к. у нас как бы "зеркалирование" данных:

```auto
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 182,
  "active_shards" : 364,

```

1. можно ли добиться распределения данных по дата нодам не дублируя их? Т.е. более важна скорость работы кластера чем сохранность данных. Если говорить про 3 дата ноды, то вместо 1.5Т данных на каждой дата ноде иметь по 500G на каждой и при выход любой ноды 1/3 часть данных просто не будет отображаться в кибане, но на работе кластера не отразиться.

---

<div class="post-metadata">

### Author: ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)
#### Post date: [January 24, 2023, 4:45pm UTC](https://discuss.elastic.co/t/topic/323849/2 "2023-01-24T16:45:41Z")

</div>

Hello @freeman999 , it would be really easy for us to understand the issue if it's written in English.  
Nevertheless, for your questions:

1. Yes, your understanding is correct. In case of node failure, replica shard will be marked as primary shard.
2. If you don't want replica shards, you can always update your index template or log shipper and define `number of primary shards = number of data nodes` and `replica_shard_count=0`.

---

<div class="post-metadata">

### Author: ![freeman999](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/freeman999/32/104827_2.png) [@freeman999](https://discuss.elastic.co/u/freeman999)
#### Post date: [January 24, 2023, 5:11pm UTC](https://discuss.elastic.co/t/topic/323849/3 "2023-01-24T17:11:08Z")

</div>

@Ayush_Mathur Thank you so much for you answers !!!  
Please tell me where I can read about how to update my index template or log shipper and how to define the variables you've written about ?  
Thank you again)

---

<div class="post-metadata">

### Author: ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)
#### Post date: [January 25, 2023, 7:21am UTC](https://discuss.elastic.co/t/topic/323849/4 "2023-01-25T07:21:47Z")

</div>

@freeman999 you can read about statuc and dynamic index template settings here: [Index modules | Elasticsearch Guide [8.6] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html)

For log shipper, let's say filebeat, the index settings can be found here: [Configure Elasticsearch index template loading | Filebeat Reference [8.6] | Elastic](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-template.html)

---

<div class="post-metadata">

### Author: ![freeman999](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/freeman999/32/104827_2.png) [@freeman999](https://discuss.elastic.co/u/freeman999)
#### Post date: [January 25, 2023, 12:39pm UTC](https://discuss.elastic.co/t/topic/323849/5 "2023-01-25T12:39:40Z")

</div>

Hello, @Ayush_Mathur  
Thank you for your help!

Speaking of log shipper, we're using fluent-bit.

```auto
curl http://192.168.101.111:9200/logstash-2023.01.25/_settings?pretty
{
  "logstash-2023.01.25" : {
    "settings" : {
      "index" : {
        "routing" : {
          "allocation" : {
            "include" : {
              "_tier_preference" : "data_content"
            }
          }
        },
        "number_of_shards" : "1",
        "provided_name" : "logstash-2023.01.25",
        "creation_date" : "1674645824236",
        "number_of_replicas" : "1",
        "uuid" : "GcluE-DyRBGoMdXB-D7u9w",
        "version" : {
          "created" : "7100199"
        }
      }
    }
  }
}

```

And it seems fluent-bit does not have index template where we can change number\_of\_shards and number\_of\_replicas. Should I create own Elastic Search index template ?

---

<div class="post-metadata">

### Author: ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)
#### Post date: [January 25, 2023, 1:08pm UTC](https://discuss.elastic.co/t/topic/323849/6 "2023-01-25T13:08:43Z")

</div>

Yes, in case of fluentd and fluentd-bit, you cannot define template and index settings unfortunately.  
In this case, create an index template in Kibana (essentially stored and followed by ES) where you can specify index settings.

---

<div class="post-metadata">

### Author: ![freeman999](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/freeman999/32/104827_2.png) [@freeman999](https://discuss.elastic.co/u/freeman999)
#### Post date: [January 25, 2023, 1:48pm UTC](https://discuss.elastic.co/t/topic/323849/7 "2023-01-25T13:48:48Z")

</div>

@Ayush_Mathur

I've sent PUT to my ES:

```auto
192.168.101.111:9200/_index_template/test_1
{
  "index_patterns" : ["logstash*"],
  "priority" : 0,
  "template": {
    "settings" : {
      "number_of_shards" : 2,
      "number_of_replicas": 0
    },
    "mappings" : {
      "_source" : { "enabled" : false }
    }
  }
}

```

I've restarted my fluent-bin agent and new indexes look like:

```auto
{
    "logstash-2023.01.25": {
        "settings": {
            "index": {
                "routing": {
                    "allocation": {
                        "include": {
                            "_tier_preference": "data_content"
                        }
                    }
                },
                "number_of_shards": "2",
                "provided_name": "logstash-2023.01.25",
                "creation_date": "1674652291012",
                "number_of_replicas": "0",
                "uuid": "CRFSHrmHRh6SOXcLgN3bnQ",
                "version": {
                    "created": "7100199"
                }
            }
        }
    }
}

```

Looks great !!!

Thank you so much one more time))

P.S. to tell the truth I didn't undestand how new index knew that it would must use new index template test\_1

---

<div class="post-metadata">

### Author: ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)
#### Post date: [January 25, 2023, 3:31pm UTC](https://discuss.elastic.co/t/topic/323849/8 "2023-01-25T15:31:31Z")

</div>

Good to know it resolved your problem.

> [@freeman999](#):
>
> I didn't undestand how new index knew that it would must use new index template test\_1

In index template, you define an index pattern, for instance `logstash*` in your case. This setting makes sure that any index generated with index name following `logstash*` pattern must conform to `test_1` index template.  
To test this, you can create another index, say `test_index`, but it won't be created with settings and property mappings specified in your `test_1` template.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 22, 2023, 3:32pm UTC](https://discuss.elastic.co/t/topic/323849/9 "2023-02-22T15:32:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
