I am trying to understand how Redis AOF file works and maybe write a parser given some simple Redis AOF file. Right now I generated an AOF file by doing these commands in Redis:
SET firstkey firstvalue
SET secondkey secondvalue
and the generated AOF file looks like this:
*2
$6
SELECT
$1
0
*3
$3
SET
$8
firstkey
$10
firstvalue
*3
$3
SET
$9
secondkey
$11
secondvalue
I can see the keywords like firstkey, firstvalue and SET, etc. But I didn't quite understand the rest, espcially what all these numbers like *2
, $6
means, and how they work when redis trying to read the aof file and rebuild the database. I couldn't find any file format document online either, so any help is appreciated!