redis默认读取appendonly.aof文件
dump.rdb 与 appendonly.aof 同时存在的情况下默认优先读取appendonly.aof文件。如果appendonly.aof有错误则启动会失败。vim appendonly.aof*2 $6 SELECT $1 ... v3 dfsdfsdfsdfsdfsd;;;;;;;;sdfsdf;;;;;;;sd;f;;; // 乱加的启动失败[mhbtestroot redis-5.0.4]$ src/redis-server redis_aof.conf 19838:C 15 Dec 2020 16:37:13.330 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 19838:C 15 Dec 2020 16:37:13.330 # Redis version5.0.4, bits64, commit00000000, modified0, pid19838, just started 19838:C 15 Dec 2020 16:37:13.330 # Configuration loaded [mhbtestroot redis-5.0.4]$ src/redis-cli -p 6379 Could not connect to Redis at 127.0.0.1:6379: Connection refused not connected通过命令redis-check-aof启动成功[mhbtestroot redis-5.0.4]$ src/redis-check-aof --fix appendonly.aof 0x 6e: Expected prefix *, got: d AOF analyzed: size156, ok_up_to110, diff46 This will shrink the AOF from 156 bytes, with 46 bytes, to 110 bytes Continue? [y/N]: y Successfully truncated AOF[mhbtestroot redis-5.0.4]$ src/redis-server redis_aof.conf 22117:C 15 Dec 2020 16:41:25.754 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 22117:C 15 Dec 2020 16:41:25.754 # Redis version5.0.4, bits64, commit00000000, modified0, pid22117, just started 22117:C 15 Dec 2020 16:41:25.754 # Configuration loaded [mhbtestroot redis-5.0.4]$ src/redis-cli -p 6379 127.0.0.1:6379 ping PONG 127.0.0.1:6379