Reputation: 237
i am using docker to start using postgres, kibana, elasticsearch and redis.(using docker-compose up command). However redis failed to start giving this error.
You can see read the last error line in the screenshot(showing bad file format). How can i resolve this? Also i dont know how to run redis commands in terminal using docker such as ./redis-check-aof --fix as given in screenshot?
Upvotes: 3
Views: 2663
Reputation: 938
I'd like to add some additional information regarding this issue with a redis:7
docker container after rebuilding a server from a snapshot.
appenddirname
parameter in the config (defaults to appendonlydir
).y/N
response (you don't actually see the Continue [y/N]
after you've pressed a key; strange but true). After pressing y
you will see a message that it's succesfully truncated.$ docker compose run --rm -it redis redis-check-aof --fix /data/appendonlydir/appendonly.aof.18.incr.aof
Start checking Old-Style AOF
AOF /data/appendonlydir/appendonly.aof.18.incr.aof format error
AOF analyzed: filename=/data/appendonlydir/appendonly.aof.18.incr.aof, size=25858048, ok_up_to=25857792, ok_up_to_line=511436, diff=256
This will shrink the AOF /data/appendonlydir/appendonly.aof.18.incr.aof from 25858048 bytes, with 256 bytes, to 25857792 bytes
y
Continue? [y/N]: Successfully truncated AOF /data/appendonlydir/appendonly.aof.18.incr.aof
Start checking Old-Style AOF
AOF analyzed: filename=/data/appendonlydir/appendonly.aof.18.incr.aof, size=25857792, ok_up_to=25857792, ok_up_to_line=511436, diff=0
AOF /data/appendonlydir/appendonly.aof.18.incr.aof is valid
Then up your redis like normally, and if everything went well, you should have a working container again.
Upvotes: 1
Reputation: 5362
Like Uku mentions, the AOF file has become corrupted and you should run a command to fix it. The correct command for the official Redis redis:4.0.11-alpine
image is:
docker-compose run redis redis-check-aof --fix appendonly.aof
This assumes the name of your redis container is "redis". Hit "y" to confirm (it's not phrased like a question but it needs that input.
Upvotes: 7
Reputation: 42030
EDIT: Your redis AOF file has become corrupted. Two options:
1) if you don't care about the data, you could just delete the volume and recreate it
2) if you do care about the data, temporarily add the entrypoint definition for redis service:
entrypoint:
- redis-check-aof
- --fix
- /data/appendonly.aof
docker-compose up once, and then remove it, this should hopefully fix it
Upvotes: 0