> ## Documentation Index
> Fetch the complete documentation index at: https://snapr.seshuk.im/llms.txt
> Use this file to discover all available pages before exploring further.

# Redis

> Back up Redis as an RDB snapshot: live dumps via redis-cli or direct copies of an existing RDB file.

`type: redis` produces an RDB snapshot in one of two modes:

1. **Live dump (default)** — runs `redis-cli --rdb <out>` against a running server. Redis triggers a background save and streams the resulting RDB to snapr.
2. **File copy** — when `path` is set, snapr copies the existing RDB file from disk. No server connection is made.

## Example

```yaml snapr.yaml theme={null}
sources:
  - type: redis
    host: cache.internal
    port: 6379
    username: backup
    password: env:REDIS_PASSWORD
```

## Options

| Option     | Type    | Required | Default     | Description                                                                                 |
| ---------- | ------- | -------- | ----------- | ------------------------------------------------------------------------------------------- |
| `type`     | `redis` | Yes      |             |                                                                                             |
| `path`     | string  | No       |             | Absolute path to an RDB file. When set, snapr copies it instead of dumping.                 |
| `host`     | string  | No       | `127.0.0.1` | Ignored when `socket` or `path` is set.                                                     |
| `port`     | int     | No       | `6379`      |                                                                                             |
| `socket`   | string  | No       |             | UNIX socket path.                                                                           |
| `username` | string  | No       |             | Redis 6+ ACL username, passed as `--user`.                                                  |
| `password` | string  | No       |             | Passed via the `REDISCLI_AUTH` environment variable, never on the command line. Use `env:`. |

## Requirements

* For live dumps, `redis-cli` must be installed on the snapr host and available in `PATH` (Debian/Ubuntu: `redis-tools`).
* For file copies, snapr only needs read access to the RDB file — no client tools required.
* When ACLs are enabled, the configured user needs at least `~* +@read +bgsave +replconf +psync +ping`, or simply `~* +@all` for a dedicated backup user.

## Notes

* A live dump triggers a save on the server side. On large datasets, the snapshot fork can briefly affect memory and latency.
* The output filename is always `dump.rdb` inside the job's working directory.

### File copy

```yaml snapr.yaml theme={null}
sources:
  - type: redis
    path: /var/lib/redis/dump.rdb
```

## Related

* [Sources overview](/configuration/sources/overview)
