---
title: Bi-directional disaster recovery
description: Learn how to set up disaster recovery between two clusters based on bi-directional cross-cluster replication. The following tutorial is designed for data...
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4173/deploy-manage/tools/cross-cluster-replication/bi-directional-disaster-recovery
products:
  - Elasticsearch
---

# Bi-directional disaster recovery
Learn how to set up disaster recovery between two clusters based on bi-directional cross-cluster replication. The following tutorial is designed for data streams which support [update by query](/elastic/docs-content/pull/4173/manage-data/data-store/data-streams/use-data-stream#update-docs-in-a-data-stream-by-query) and [delete by query](/elastic/docs-content/pull/4173/manage-data/data-store/data-streams/use-data-stream#delete-docs-in-a-data-stream-by-query). You can only perform these actions on the leader index.
This tutorial works with Logstash as the source of ingestion. It takes advantage of a Logstash feature where [the Logstash output to Elasticsearch](https://docs-v3-preview.elastic.dev/elastic/logstash-docs-md/tree/main/lsr/plugins-outputs-elasticsearch) can be load balanced across an array of hosts specified. Beats and Elastic Agents currently do not support multiple outputs. It should also be possible to set up a proxy (load balancer) to redirect traffic without Logstash in this tutorial.
- Setting up a remote cluster on `clusterA` and `clusterB`.
- Setting up bi-directional cross-cluster replication with exclusion patterns.
- Setting up Logstash with multiple hosts to allow automatic load balancing and switching during disasters.

![Bi-directional cross cluster replication failover and failback](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4173/deploy-manage/images/elasticsearch-reference-ccr-bi-directional-disaster-recovery.png)