---
title: "Standby and failover"
description: "Turn on a standby so a cache fails over by itself, and what a failover changes on Valkey and Memcached."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Standby and failover

A **standby** is a second copy of the cache, kept apart from the first, that takes over when the cache
fails. The endpoint moves to it, and clients reconnect to the same name.

| | Valkey | Memcached |
| --- | --- | --- |
| The standby holds | A live copy of the data | Nothing: it's empty, ready to serve |
| After a failover | The data is there | The cache starts empty |
| Without a standby | The cache is replaced, in minutes. A persistent cache keeps its data; a memory-only one starts empty | The cache is replaced, in minutes, empty |

A failover takes seconds.

## Turn the standby on or off

### Console

On the cache's **Details** tab, turn **Standby** on or off.
### CLI

```sh
ezgh caches update cch_4k2m9x0a7qpe --standby --wait
ezgh caches update cch_4k2m9x0a7qpe --standby=false --wait
```

Turning it on takes minutes. On Valkey, the cache is `available` once the standby holds a full copy.
Turning it off removes the standby; the cache keeps serving.

## Fail over yourself

To test how your app reconnects:

```sh
ezgh caches failover cch_4k2m9x0a7qpe --wait
```

- **Valkey**: writes pause for a few seconds until the standby has every write, then the endpoint
  moves. No data is lost. Open connections end, and clients reconnect.
- **Memcached**: the endpoint moves to the standby, and the cache starts empty.

It's refused with `409 no_standby` when the cache has no standby. In the console, it's **Fail over** on
the cache's page.

## What a failover changes

- The endpoint, the cache's ID, its users and their passwords stay the same.
- Open connections end. Clients with [timeouts](/caches/connect-apps#timeouts) reconnect to the
  endpoint within seconds.
- The cache gets a new standby by itself, `recovering` until it's ready, and serves meanwhile.
- Failovers are listed in the cache's [events](/caches/monitoring#events).

Source: https://docs.ezghcloud.com/caches/standby-and-failover/index.mdx
