sachin
sachin

Reputation: 14355

Data lost after redis server restart

Im using redis 2.8.3 server to store key value pairs in redis.

redis.conf

port 6378
bind 127.0.0.1
databases 16

After restarting the redis-server

  redis-server /home/redis.conf

Im loosing all the keys which i have already stored in redis.Can anyone help me to solve this.

Upvotes: 7

Views: 12971

Answers (3)

Mohammad Yaser Ahmadi
Mohammad Yaser Ahmadi

Reputation: 5031

to prevent removing data from redis after restarting redis service in windows, you should update redis.windows-service.conf. Redis SAVE command is used to create backup of current redis database

Save the DB on disk: save seconds changes

Will save the DB if both the given number of seconds and the given number of write operations against the DB occurred

In the example below the behaviour will be to save:

  1. after 1sec if at least 1 key changed
  2. after 100sec if at least 50 keys changed

like in the following example, in SNAPSHOTTING section:

################################ SNAPSHOTTING  ################################
save 1 1
save 100 50

after making changes, restart redis service, you can download last version of redis for windows

Upvotes: 0

Tagore Bavanasi
Tagore Bavanasi

Reputation: 31

Use this configuration settings, which will help you to sync data using a background process:

# appendfsync always
appendfsync everysec
# appendfsync no

Upvotes: 0

chrislovecnm
chrislovecnm

Reputation: 2611

If you run a 'BGSAVE' before you shut down the server does that help?

The shutdown script should always run that....

Upvotes: 6

Related Questions