{
  "schema_version": 2,
  "id": "integrate/redis-data-integration/installation/ha-test",
  "title": "Test HA failover",
  "url": "https://redis.io/docs/latest/integrate/redis-data-integration/installation/ha-test/",
  "summary": "Learn how to perform HA failover testing for Redis Data Integration (RDI) to ensure high availability and reliability of your data integration setup.",
  "tags": [
    "docs",
    "integrate",
    "rs",
    "rdi"
  ],
  "last_updated": "2026-09-18T16:39:21+01:00",
  "page_type": "content",
  "content_hash": "a88a39077f12252ac6477ad2e876643fe57ecb1a0c25397f1eb5a6915c3be937",
  "sections": [
    {
      "id": "setup",
      "title": "Setup",
      "role": "setup",
      "text": "1. Ensure that RDI is up and running on both primary and secondary nodes.\n   Run the following command and verify and that each instance should show healthy and running `rdi-api` and `rdi-operator` pods.\n[code example]\n\n2. Identify the leader node (this is the one that has a running collector pod). A\n   collector is named after its source, so the example above shows `collector-mysql` for a\n   source named `mysql`.\n\n   You can also ask each node about the pipeline directly. On the follower, the pipeline\n   stands by:\n\n   [code example]\n\n   [`redis-di describe`](https://redis.io/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-describe)\n   shows `Status: standby` on the follower, and\n   [`redis-di info`](https://redis.io/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-info)\n   shows `Leader Election Mode: follower`."
    },
    {
      "id": "performing-the-ha-failover-testing",
      "title": "Performing the HA Failover Testing",
      "role": "content",
      "text": "To perform HA, you can simulate a connection failure between the leader and the RDI database by blocking the network traffic. You can do this by running the following commands on the leader node:\n\n1. Identify the RDI database IP (replace `<hostname>` with your own hostname):\n[code example]\n\n2. For each of the IPs returned by the above command, run the following command to block the traffic:\n\n[code example]\n\n\nThe default configuration for the leader lock is 60 seconds, so it may take up to 2 minutes for the failover to occur.\nMeanwhile you can follow the logs of the operator to see the failover process:\n\n[code example]\n\nIn about 10 seconds you will start seeing log entries from the leader saying that it could not acquire the leadership.\nWhen the leader lock expires, the second node will acquire the leadership and you will see log entries from the second node indicating that it has become the leader.\n\nOnce the failover completes, the two nodes swap their pipeline phases: the pipeline has\n`Active` status on the new leader and `Standby` status on the old one."
    },
    {
      "id": "cleanup",
      "title": "Cleanup",
      "role": "content",
      "text": "To clean up after the test, remove the `iptables` rule that you added to block the traffic:\n\n```sudo iptables -D FORWARD -d <databse_ip> -j DROP```\n\nUse `sudo iptables -S | grep <database_ip>` to verify that the rule has been removed."
    }
  ],
  "examples": [
    {
      "id": "setup-ex0",
      "language": "plaintext",
      "code": "kubectl -n rdi get pods\n\n# Example output:\nNAME                                   READY   STATUS      RESTARTS      AGE\ncollector-api-577d95bfd8-5wbg6         1/1     Running     0             12m\ncollector-mysql-95f45bcf7-vwn5l        1/1     Running     0             12m\nfluentd-zq2lc                          1/1     Running     0             72m\nlogrotate-29530445-j729x               0/1     Completed   0             14m\nlogrotate-29530450-dprr2               0/1     Completed   0             9m40s\nlogrotate-29530455-mfmzw               0/1     Completed   0             4m40s\nprocessor-f66655469-h7nw2              1/1     Running     0             12m\nrdi-api-f75df6796-qwqjw                1/1     Running     0             72m\nrdi-metrics-exporter-d57cdf8c8-wjzb5   1/1     Running     0             72m\nrdi-operator-7f7f6c7dfd-5qmjd          1/1     Running     0             71m\nrdi-reloader-77df5f7854-lwmvz          1/1     Running     0             71m",
      "section_id": "setup"
    },
    {
      "id": "setup-ex1",
      "language": "plaintext",
      "code": "kubectl -n rdi get pipeline default -o jsonpath='{.status.phase}'\n\n   # Example output on the follower:\n   Standby\n\n   # Example output on the leader:\n   Active",
      "section_id": "setup"
    },
    {
      "id": "performing-the-ha-failover-testing-ex0",
      "language": "plaintext",
      "code": "dig +short <hostname>\n\n# Example:\n# dig +short my.redis.hostname.com\n\n# Example output:\n54.78.220.161",
      "section_id": "performing-the-ha-failover-testing"
    },
    {
      "id": "performing-the-ha-failover-testing-ex1",
      "language": "plaintext",
      "code": "sudo iptables -I FORWARD -d <database_ip> -j DROP\n\n# With the IP from the example above, the command would be:\nsudo iptables -I FORWARD -d 54.78.220.161 -j DROP",
      "section_id": "performing-the-ha-failover-testing"
    },
    {
      "id": "performing-the-ha-failover-testing-ex2",
      "language": "plaintext",
      "code": "kubectl -n rdi logs rdi-operator-7f7f6c7dfd-5qmjd -f",
      "section_id": "performing-the-ha-failover-testing"
    }
  ]
}
