Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The documentation makes it sound like persistence is disabled by default #262

Open
x-yuri opened this issue Jan 19, 2021 · 6 comments
Open

Comments

@x-yuri
Copy link

x-yuri commented Jan 19, 2021

start with persistent storage

$ docker run --name some-redis -d redis redis-server --appendonly yes

If persistence is enabled, data is stored in the VOLUME /data, which can be used with --volumes-from some-volume-container or -v /docker/host/dir:/data (see docs.docker volumes).

For more about Redis Persistence, see http://redis.io/topics/persistence.

https://hub.docker.com/_/redis

@tianon
Copy link
Contributor

tianon commented Jan 19, 2021 via email

@x-yuri
Copy link
Author

x-yuri commented Jan 19, 2021

An issue :) Suggestion to improve the documentation. Not a question.

The documentation is misleading about this. I'm not sure if this part is needed at all. Although maybe in older version of redis it really ran without persistence by default.

I'm not sure where that part of the documentation comes from. If it covers only the latest builds, then one option is to remove the section. Or suggest to run redis with a named volume. Or document how to run it with AOF. Although I'm not sure what effect would specifying the --appendonly yes option have:

https://github.com/docker-library/redis/blob/f634377/6.0/alpine/Dockerfile#L40-L48
#263

@x-yuri
Copy link
Author

x-yuri commented Jan 19, 2021

I just confirmed that redis apparently at least saves its state before shutdown. (What are its settings exactly is not clear since #263.) But if you're running Docker Swarm, you should name your mounts.

@x-yuri
Copy link
Author

x-yuri commented Jan 20, 2021

It seems that if you specify any argument to redis-server, they assume you are going to specify everything.

@yosifkit It totally looks that way, but on closer inspection it appears that redis only resets the save parameters (when argc >= 2). It's there since day one. Probably because there's no way to reset them via command line.

It can be cured by explicitly specifying the save params:

#!/bin/sh -eu
run() {
    cid=`docker run --rm -itd redis:alpine "$@"`
    docker exec "$cid" redis-cli config get save
    docker stop "$cid"
}
run
run --bind 0.0.0.0
run --save 3600 1 --save 300 100 --save 60 10000

Output:

save
3600 1 300 100 60 10000
fcdf7763cb52de51f4c99f3fea9d13a2aa99f4d56bd23f0da378e4a80f3e732e
save

554503ffeed5dfe3fc7232e3a646989d9e6745dc4d069aebd3124f756229f6fe
save
3600 1 300 100 60 10000
e7544eec533b3d657bb2f47e92121125a0326a8702b074714a5a0f4395a44f94

@MattJustMatt
Copy link

This is confusing. I want to run with no persistence, so I've appendonly and save in the config file, but a volume is still being created. Not the end of the world but it's not clear from the docs how to disable this.

@jamesbraza
Copy link

+1 to this, there's room for clarification. https://hub.docker.com/r/redis/redis-stack is where I am coming from

In its persistence section, it documents what happens when passing -v. However, what happens when one doesn't pass -v isn't described, like if the Docker container is stopped without -v, will one lose all data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants