What is the default location for Redis AOF file for Ubuntu?
Asked Answered
A

5

9

Background

Yesterday our machine crashed unexpectedly and our AOF file for Redis got corrupted.

Upon trying to start the service with sudo systemctl start redis-server we are greeted with the following logs:

Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix

Research

Aparently this looks like a simple error to fix, just execute ./redis-check-aof --fix <filename>.

Except I don't have the smallest idea of where that file is.

I have searched the Github discussions for this issue, but unfortunately none provides me with the location for the file:

The persistence documentation also doesn't make a mention of the location for this file:

Specs

These are the specs of the system where I am running Redis:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial

Question

Where is located this file?

Archfiend answered 24/5, 2018 at 8:37 Comment(0)
P
13

You have two choices:

  1. Find the configure file for Redis, normally, it's named redis.conf. The dir and appendfilename configuration specify the directory and file name of the AOF file.
  2. Connect to Redis with redis-cli, and use the CONFIG GET command to get the dir configuration, i.e. CONFIG GET dir. The AOF file should located under this directory.
Prophets answered 24/5, 2018 at 10:50 Comment(0)
L
5

The path is typically /var/lib/redis/appendonly.aof you will need to run sudo redis-check-aof --fix /var/lib/redis/appendonly.aof

Lurdan answered 8/10, 2018 at 15:53 Comment(1)
cat: /var/lib/redis/appendonly.aof: No such file or directoryPortemonnaie
P
4

in case if you use docker and append volume to /data then the path to appendonly.aof will be: /data/appendonly.aof

Portemonnaie answered 17/1, 2019 at 15:41 Comment(0)
R
3

In my case, I was using docker. I started the redis server without using --appendonly yes, then it started without any issues. And then ran CONFIG GET dir like @for-stack said and got this output:

1) "dir"
2) "/data"

So I checked under the /data path and found the file appendonly.aof

Then I ran /usr/local/bin/redis-check-aof --fix /data/appendonly.aof to fix the issue.

Retriever answered 18/1, 2021 at 8:6 Comment(0)
S
0

I ran /path/redis-check-aof --fix /data/appendonly.aof to fix this. Thanks all.

Shrubbery answered 8/8, 2022 at 3:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.