I am running redis server and have set the dir to /var/lib/redis
and dbfilename to dump.rdb
in the redis.conf file but i notice redis starts to produce these errors below
120844:C 23 Sep 02:59:31.098 # Failed opening .rdb for saving: Read-only file system
42657:M 23 Sep 02:59:31.198 # Background saving error
42657:M 23 Sep 02:59:37.018 * 1 changes in 900 seconds. Saving...
42657:M 23 Sep 02:59:37.019 * Background saving started by pid 120868
120868:C 23 Sep 02:59:37.019 # Failed opening .rdb for saving: Read-only file system
42657:M 23 Sep 02:59:37.119 # Background saving error
42657:M 23 Sep 02:59:43.035 * 1 changes in 900 seconds. Saving...
42657:M 23 Sep 02:59:43.036 * Background saving started by pid 120869
120869:C 23 Sep 02:59:43.036 # Failed opening .rdb for saving: Read-only file system
42657:M 23 Sep 02:59:43.136 # Background saving error
42657:M 23 Sep 02:59:49.052 * 1 changes in 900 seconds. Saving...
42657:M 23 Sep 02:59:49.052 * Background saving started by pid 120895
120895:C 23 Sep 02:59:49.053 # Failed opening .rdb for saving: Read-only file system
42657:M 23 Sep 02:59:49.153 # Background saving error
42657:M 23 Sep 02:59:55.067 * 1 changes in 900 seconds. Saving...
42657:M 23 Sep 02:59:55.067 * Background saving started by pid 120939
then i get into redis-cli to fix this with the following commands
127.0.0.1:6379> config set dbfilename dump.rdb
OK
127.0.0.1:6379> config set dir /var/lib/redis
OK
127.0.0.1:6379> exit
and then i check the redis logs now and then it is working fine
42657:M 23 Sep 03:00:43.011 * Background saving started by pid 121168
121168:C 23 Sep 03:00:43.011 # Failed opening .rdb for saving: Read-only file system
42657:M 23 Sep 03:00:43.122 # Background saving error
42657:M 23 Sep 03:00:49.035 * 1 changes in 900 seconds. Saving...
42657:M 23 Sep 03:00:49.036 * Background saving started by pid 121170
121170:C 23 Sep 03:00:49.233 * DB saved on disk
121170:C 23 Sep 03:00:49.233 * RDB: 0 MB of memory used by copy-on-write
42657:M 23 Sep 03:00:49.236 * Background saving terminated with success
and then after a few minutes redis is back to the previous error again and mind you..the redis.conf file has the dir and dbfilename set already so am not sure what is going on.
How do i fix the error? Not sure if this is a common bug or something.
I am running redis redis-server --version
Redis server v=3.0.6 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=687a2a319020fa42
P.S. I am running some django applications that are run using gunicorn and these applications use redis database so..whenever the redis is working fine the applications work fine and as soon redis start giving the errors described above the applications starts to give 502 errors and i get the follwoing errors
[error] 1808#1808: *14662 upstream prematurely closed connection while reading response header from upstream, client: 172.xxx.xxx.xxx, server: xxxxx.com, request: "GET /U/example-url/ HTTP/1.1", upstream: "http://unix:/mnt/http/nginx/xxxxx.com/run/gunicorn.sock:/U/example-url/", host: "xxxxx.com"
So not sure if the applciations kill redis or redis kills the applications..either way why is redis settings getting killed and how do i persist the dir and dbfilename settings?
Thanks
TO FIX the issue, i always have to like to do this every like few minutes when the redis gives up again
:~# redis-cli
127.0.0.1:6379> config set dir /var/lib/redis
OK
127.0.0.1:6379> config set dbfilename dump.rdb
OK
127.0.0.1:6379> exit
So how can i persist this so i dont have to do this everytime to bring the django websites using the redis database up?
UPDATE:
here is output of redis-cli info
command
127.0.0.1:6379> info
# Server
redis_version:3.0.6
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:687a2a319020fa42
redis_mode:standalone
os:Linux 4.4.0-133-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:5.3.1
process_id:3957
run_id:dfac396ca05cb307c830abcdcd10b916f536b6fd
tcp_port:6379
uptime_in_seconds:263
uptime_in_days:0
hz:10
lru_clock:10965575
config_file:/etc/redis/redis.conf
# Clients
connected_clients:8
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
# Memory
used_memory:4663560
used_memory_human:4.45M
used_memory_rss:7491584
used_memory_peak:4726624
used_memory_peak_human:4.51M
used_memory_lua:36864
mem_fragmentation_ratio:1.61
mem_allocator:jemalloc-3.6.0
# Persistence
loading:0
rdb_changes_since_last_save:84
rdb_bgsave_in_progress:0
rdb_last_save_time:1537691968
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
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
# Stats
total_connections_received:44
total_commands_processed:325
instantaneous_ops_per_sec:0
total_net_input_bytes:25453
total_net_output_bytes:652106
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:84
evicted_keys:0
keyspace_hits:88
keyspace_misses:109
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0
# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
# CPU
used_cpu_sys:0.08
used_cpu_user:0.23
used_cpu_sys_children:0.00
used_cpu_user_children:0.00
# Cluster
cluster_enabled:0
# Keyspace
db0:keys=10,expires=0,avg_ttl=0
db5:keys=2,expires=2,avg_ttl=32239229
db6:keys=14432,expires=0,avg_ttl=0
db8:keys=10,expires=10,avg_ttl=1821207715
db9:keys=873,expires=0,avg_ttl=0
0 Answers