Here's our environment:
OS: DEBIAN 7 (wheezy) 64 bit Redis: 2.8.22 standalone mode Mode: slave Configuration:
daemonize yes
pidfile /var/run/redis-server.pid
logfile /var/log/redis/redis.log
save 1800 1
save 600 10
save 120 1000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis/
repl-timeout 21600
maxclients 20000
maxmemory 6gb
maxmemory-policy allkeys-lru
appendfilename appendonly.aof
Despite the above configuration, here's what it reports from redis-cli:
127.0.0.1:6379> config get save
1) "save"
2) ""
127.0.0.1:6379> config get dbfilename
1) "dbfilename"
2) "dump.rdb"
127.0.0.1:6379> config get dir
1) "dir"
2) "/var/lib/redis"
Here's the output from the info persistence command:
loading:0
rdb_changes_since_last_save:41263697
rdb_bgsave_in_progress:0
rdb_last_save_time:1530127821
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:21
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
Note the unusually high value for the rdb_changes_since_last_save key.
Here's the output from the info server command:
# Server
redis_version:2.8.22
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:770ddd3b4723f6b2
redis_mode:standalone
os:Linux 3.2.0-4-amd64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.7.2
process_id:12414
run_id:1094bd162c6c12728bb70c544f2c73d26b0220e3
tcp_port:6379
uptime_in_seconds:31774114
uptime_in_days:367
hz:10
lru_clock:5411563
config_file:/etc/redis/redis-server.conf
From the command history of redis-cli, apart from a BGSAVE nothing else was done that would have interfered with the persistence mechanism.
However, the redis log reports successful attempts at saving to RDB:
[12414] 27 Jun 01:00:00.355 * Background saving started by pid 7409
[7409] 27 Jun 01:00:21.263 * DB saved on disk
[7409] 27 Jun 01:00:21.303 * RDB: 1 MB of memory used by copy-on-write
[12414] 27 Jun 01:00:21.411 * Background saving terminated with success
[12414] 27 Jun 07:00:00.399 * Background saving started by pid 19393
[19393] 27 Jun 07:00:21.776 * DB saved on disk
[19393] 27 Jun 07:00:21.816 * RDB: 2 MB of memory used by copy-on-write
[12414] 27 Jun 07:00:21.939 * Background saving terminated with success
[12414] 27 Jun 13:00:00.521 * Background saving started by pid 31572
[31572] 27 Jun 13:00:22.344 * DB saved on disk
[31572] 27 Jun 13:00:22.385 * RDB: 5 MB of memory used by copy-on-write
[12414] 27 Jun 13:00:22.515 * Background saving terminated with success
[12414] 27 Jun 19:00:00.376 * Background saving started by pid 4684
[4684] 27 Jun 19:00:23.044 * DB saved on disk
[4684] 27 Jun 19:00:23.086 * RDB: 2 MB of memory used by copy-on-write
[12414] 27 Jun 19:00:23.219 * Background saving terminated with success
[12414] 28 Jun 01:00:00.430 * Background saving started by pid 10475
[10475] 28 Jun 01:00:21.642 * DB saved on disk
[10475] 28 Jun 01:00:21.683 * RDB: 1 MB of memory used by copy-on-write
[12414] 28 Jun 01:00:21.783 * Background saving terminated with success
So, ever since this redis server has been started (almost an year ago!!!), it has never persisted data to disk, which is shocking. I have already greped the log file for MISCONF and found no matching lines.
Please help.
Comment From: charsyam
@KalyanAkella how many data are in your redis server? your redis server has right permission to write in /var/lib/redis/ ?
Comment From: KalyanAkella
@charsyam
Here's the output from info keyspace command:
# Keyspace
db0:keys=7055332,expires=0,avg_ttl=0
db1:keys=9516,expires=0,avg_ttl=0
db2:keys=7061010,expires=0,avg_ttl=0
db3:keys=8,expires=0,avg_ttl=0
And yes, the redis-server process executes as root and has the permissions to write to /var/lib/redis directory.
Comment From: yoav-steinberg
@KalyanAkella is this still relevant?
If so do you have replication enabled?
Is there any dump.rdb in /var/lib/redis?
Can you try running a config set save "1800 1 600 10 120 1000" and check the config get save output again?
Any chance of upgrading the redis and re-checking?
Marking this to be closed as it's been a while and this seems like some one-off case.
Comment From: Tompickett21
I am having a similar issue. Ubuntu server 18.04 Django application using redis I am getting the error: "Unable to create a new session key. It is likely that the cache is unavailable." I fixed all the warnings, but I still get: $ sudo tail /var/log/redis/redis-server.log -n 100
8185:C 08 Sep 12:56:03.080 * RDB: 0 MB of memory used by copy-on-write 1206:M 08 Sep 12:56:03.128 * Background saving terminated with success
Comment From: Tompickett21
I may have fixed my error not having the right redis URL in my application. It needed to be redis://localhost:6379/0 . I will see if this fixes it long term.
Comment From: yoav-steinberg
@Tompickett21 it seems like your database is empty and it makes sense if you're using a bad url and not actually accessing the redis-server from your app. I'm closing this as the original author isn't responding and this seems more like a configuration issue than a real bug.