-
Notifications
You must be signed in to change notification settings - Fork 569
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
Doesn't save on SIGTERM #4
Comments
By default redis is only an "in memory" key/value store. If you change your first run to make redis persistent: We forgot to add this to the documentation on the hub when we added the volume, it should be there in the next day or so. |
@yosifkit That's not the point. Redis enables RDB persistence by default. On shutdown (and on SIGTERM) it should automatically initiate a save. For some reason this is not happening here. |
Ok, it's clear now why it won't save on SIGTERM: docker run -it --link some-redis:redis --rm redis sh -c 'redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT" CONFIG GET save'
1) "save"
2) "" There are no save intervals set, for whatever reason. |
Never mind, I run this test against the wrong image. It works just as expected now: % docker run -it --link some-redis:redis --rm redis sh -c 'redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT" CONFIG GET save'
1) "save"
2) "3600 1 300 100 60 10000" Log after
This is not a bug then. |
I hit just $ docker run -it --link some-redis:redis --rm redis sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT" CONFIG GET save'
1) "save"
2) "" However, when I run it with the configuration file provided with the source code (which is not the same as the compiled-in default configuration) via $ docker run -it --link some-redis:redis --rm redis sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT" CONFIG GET save'
1) "save"
2) "900 1 300 10 60 10000" |
Hm, afaik the included redis.conf should have the same values as the built-in defaults. I'm still not sure why it doesn't work for you ("900 1 300 10 60 10000" is definitely the default compiled in this source as well as in the redis.conf). I can't reproduce it here anymore (and the one time I could reproduce it was against another Redis image, probably older, not sure). Can you try removing the complete redis image from docker ( |
Okay... I did a docker build from this repo and the issue does not exist any more. I didn't see any redis.conf other than in /usr/src/redis within either of the images |
I built a new image from the repo. The only difference between this and the current release is the removal of The first line only shows up when specifying no arguments to $ docker run -it --rm --name some-redis redis redis-server
[1] 31 Jul 15:55:23.775 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.12 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 1
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
... (and the rest of the server start) I will get the no args version up to stackbrew (the official image builder). For now you can run it with |
This has been fixed in the latest version of redis and is now much smaller. (no need for |
Next solution worked for me (latest redis, 3.2): # docker-compose.yml
services:
foo_redis:
image: redis
command: redis-server --appendonly yes |
The problem is back (caused by the "protected mode" workaround). |
Poo 😞 |
This might mean we have to patch the source to change the "protected mode" default value. 😭 |
Seems like we could just modify https://github.com/antirez/redis/blob/a81a92ca2ceba364f4bb51efde9284d939e7ff47/src/server.h#L118 ( |
On SIGTERM a dump.rdb should be created when no special parameters are passed. see redis/docker-library-redis#4
On SIGTERM a dump.rdb should be created when no special parameters are passed. see redis/docker-library-redis#4
On SIGTERM a dump.rdb should be created when no special parameters are passed. see redis/docker-library-redis#4
On SIGTERM a dump.rdb should be created when no special parameters are passed. see redis/docker-library-redis#4
For those interested in why
welcome to the adjacent issue. |
could we reopen it? Our use case On kubernetes, we use argo-workflow to run tests. Redis is deployed as a daemon:
Run fine, when the workflow stop, redis stay because the SIGTERM stuff failed. How run redis 100% on memory without the snapshot stuff please? |
@ebuildy, I think that if you don't want persistence then either start redis with an empty $ # regular run
$ docker run -it --rm --name redi redis
...
^C1:signal-handler (1677110921) Received SIGINT scheduling shutdown...
1:M 23 Feb 2023 00:08:41.487 # User requested shutdown...
1:M 23 Feb 2023 00:08:41.487 * Saving the final RDB snapshot before exiting.
1:M 23 Feb 2023 00:08:41.499 * DB saved on disk
1:M 23 Feb 2023 00:08:41.499 # Redis is now ready to exit, bye bye...
$ docker exec -it redi redis-cli config get save
1) "save"
2) "3600 1 300 100 60 10000"
$ # no save run
$ docker run -it --rm --name redi redis --save
...
1:M 23 Feb 2023 00:08:49.650 * Ready to accept connections
^C1:signal-handler (1677110940) Received SIGINT scheduling shutdown...
1:M 23 Feb 2023 00:09:00.132 # User requested shutdown...
1:M 23 Feb 2023 00:09:00.132 # Redis is now ready to exit, bye bye...
$ .. $ docker exec -it redi redis-cli config get save
1) "save"
2) ""
|
thanks you! |
According to http://redis.io/topics/signals Redis is supposed to do a save on SIGTERM:
According to http://docs.docker.com/reference/commandline/cli/#stop Docker sends a SIGTERM followed by a SIGKILL after a period (10 second default).
It seems to receive the SIGTERM and gracefully shutdown but it does so without a save.
Subsequent start of the container doesn't have the data.
The text was updated successfully, but these errors were encountered: