Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions redis/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
GO = go
EXT =

PLAKAR ?= plakar
VERSION ?= v1.0.0

GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
PTAR := redis_$(VERSION)_$(GOOS)_$(GOARCH).ptar

all: build

build:
${GO} build -v -o redisImporter${EXT} ./plugin/importer
${GO} build -v -o redisFileExporter${EXT} ./plugin/exporter

package: build
rm -f $(PTAR)
$(PLAKAR) pkg create ./manifest.yaml $(VERSION)

uninstall:
-$(PLAKAR) pkg rm redis

install: package
$(PLAKAR) pkg add ./$(PTAR)

reinstall: uninstall install

clean:
rm -f redisImporter redisFileExporter redis_*.ptar
67 changes: 67 additions & 0 deletions redis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Redis Integration

This integration lets Plakar back up Redis persistent data as an RDB dump and restore that dump to a file Redis can load on startup.

## How it works

The importer connects to a running Redis server using the Redis replication protocol and stores one record in the snapshot:

- `/dump.rdb` - an RDB snapshot generated by Redis for the backup stream.

This covers Redis deployments where Redis is used as a primary data store. The exporter writes the saved RDB record back to a local file, usually `/var/lib/redis/dump.rdb` or another path configured by the Redis server.

## Importer options

| Parameter | Default | Description |
|---|---|---|
| `location` | `redis://localhost:6379` | Redis URI: `redis://[user[:password]@]host[:port]` or `rediss://...` for TLS. |
| `host` | `localhost` | Server hostname. Overrides the location host. |
| `port` | `6379` | Server port. Overrides the location port. |
| `username` | | ACL username. Overrides the location username. |
| `password` | | Redis password. Overrides the location password. |
| `tls` | `false` | Enable TLS. `rediss://` enables it automatically. |
| `tls_server_name` | `host` | Server name used for TLS verification. |
| `insecure_skip_verify` | `false` | Skip TLS certificate verification. Intended for local testing only. |
| `timeout` | `30s` | Dial and command timeout. Accepts Go durations such as `10s` or a number of seconds. |

## Exporter options

| Parameter | Default | Description |
|---|---|---|
| `location` | | `redis+file:///path/to/dump.rdb` destination URI. |
| `path` | | Output file or directory. Overrides location. |
| `output` | | Alias for path. |

If the destination path is a directory, the exporter writes `dump.rdb` inside it. Otherwise it writes exactly to the configured file path.

## Examples

Back up a local unauthenticated Redis instance:

```bash
plakar source add myredis redis://localhost:6379
plakar backup @myredis
```

Back up an authenticated Redis instance:

```bash
plakar source add myredis redis://default:secret@redis.example.com:6379
plakar backup @myredis
```

Back up Redis over TLS:

```bash
plakar source add myredis rediss://default:secret@redis.example.com:6380
plakar backup @myredis
```

Restore the dump to a file Redis can load on startup:

```bash
plakar destination add redisfile redis+file:///var/lib/redis/dump.rdb
plakar restore -to @redisfile <snapid>
```

Stop Redis before replacing its configured RDB file, then start Redis again so it loads the restored dump.
24 changes: 24 additions & 0 deletions redis/exporter/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Plakar Redis File Exporter Connector Config",
"type": "object",
"additionalProperties": false,
"properties": {
"location": {
"type": "string",
"minLength": 1,
"description": "Redis RDB file destination URI: redis+file:///path/to/dump.rdb.",
"pattern": "^redis\\+file://.*$"
},
"path": {
"type": "string",
"minLength": 1,
"description": "Output file or directory for dump.rdb. Overrides the location URI."
},
"output": {
"type": "string",
"minLength": 1,
"description": "Alias for path."
}
}
}
39 changes: 39 additions & 0 deletions redis/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module github.com/PlakarKorp/integration-redis

go 1.25.5

require (
github.com/PlakarKorp/go-kloset-sdk v1.1.0-beta.1
github.com/PlakarKorp/kloset v1.1.0-beta.2
)

require (
github.com/PlakarKorp/integration-grpc v1.1.0-beta.3 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/golang/snappy v1.0.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/nickball/go-aes-key-wrap v0.0.0-20170929221519-1c3aa3e4dfc5 // indirect
github.com/pierrec/lz4/v4 v4.1.25 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/tink-crypto/tink-go/v2 v2.6.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zeebo/blake3 v0.2.4 // indirect
golang.org/x/crypto v0.47.0 // indirect
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
golang.org/x/mod v0.32.0 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.40.0 // indirect
golang.org/x/text v0.33.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect
google.golang.org/grpc v1.78.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
modernc.org/libc v1.67.6 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect
modernc.org/sqlite v1.44.3 // indirect
)
Loading