Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default location for Redis AOF file for Ubuntu?

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:

  • https://github.com/antirez/redis/issues/4931

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

  • https://redis.io/topics/persistence

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?

like image 729
Flame_Phoenix Avatar asked May 24 '18 08:05

Flame_Phoenix


2 Answers

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.
like image 179
for_stack Avatar answered Sep 24 '22 12:09

for_stack


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

like image 33
yuklia Avatar answered Sep 23 '22 12:09

yuklia