Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›Репликация между кластерами ›Учебник: Резервное копирование при отказе с односторонней репликацией между кластерами

Отказ при недоступности кластера clusterA

  1. Поднимите индексы-фолловеров в clusterB до обычных индексов, чтобы они принимали записи. Это можно сделать следующим образом:

    • Сначала приостановите индексирование для индекса-фолловера.
    • Затем закройте индекс-фолловера.
    • Отключите отслеживание лидера.
    • Наконец, откройте индекс-фолловера (который на данном этапе является обычным индексом).
    resp = client.ccr.pause_follow(
        index="kibana_sample_data_ecommerce2",
    )
    print(resp)
    
    resp1 = client.indices.close(
        index="kibana_sample_data_ecommerce2",
    )
    print(resp1)
    
    resp2 = client.ccr.unfollow(
        index="kibana_sample_data_ecommerce2",
    )
    print(resp2)
    
    resp3 = client.indices.open(
        index="kibana_sample_data_ecommerce2",
    )
    print(resp3)
    response = client.ccr.pause_follow(
      index: 'kibana_sample_data_ecommerce2'
    )
    puts response
    
    response = client.indices.close(
      index: 'kibana_sample_data_ecommerce2'
    )
    puts response
    
    response = client.ccr.unfollow(
      index: 'kibana_sample_data_ecommerce2'
    )
    puts response
    
    response = client.indices.open(
      index: 'kibana_sample_data_ecommerce2'
    )
    puts response
    const response = await client.ccr.pauseFollow({
      index: "kibana_sample_data_ecommerce2",
    });
    console.log(response);
    
    const response1 = await client.indices.close({
      index: "kibana_sample_data_ecommerce2",
    });
    console.log(response1);
    
    const response2 = await client.ccr.unfollow({
      index: "kibana_sample_data_ecommerce2",
    });
    console.log(response2);
    
    const response3 = await client.indices.open({
      index: "kibana_sample_data_ecommerce2",
    });
    console.log(response3);
    ### On clusterB ###
    POST /kibana_sample_data_ecommerce2/_ccr/pause_follow
    POST /kibana_sample_data_ecommerce2/_close
    POST /kibana_sample_data_ecommerce2/_ccr/unfollow
    POST /kibana_sample_data_ecommerce2/_open
  2. На стороне клиента (Logstash, Beats, Elastic Agent) вручную снова включите загрузку данных kibana_sample_data_ecommerce2 и перенаправьте трафик на clusterB. Также следует перенаправить весь поисковый трафик на кластер clusterB в это время. Это можно смоделировать, загрузив документы в этот индекс. Вы увидите, что этот индекс теперь доступен для записи.

    resp = client.index(
        index="kibana_sample_data_ecommerce2",
        document={
            "user": "kimchy"
        },
    )
    print(resp)
    response = client.index(
      index: 'kibana_sample_data_ecommerce2',
      body: {
        user: 'kimchy'
      }
    )
    puts response
    const response = await client.index({
      index: "kibana_sample_data_ecommerce2",
      document: {
        user: "kimchy",
      },
    });
    console.log(response);
    ### On clusterB ###
    POST kibana_sample_data_ecommerce2/_doc/
    {
      "user": "kimchy"
    }

© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/_failover_when_clustera_is_down.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API