8

I installed Redis on Ubuntu 16.04. I couldn't find Redis directory nor redis.conf file (tried with: sudo find redis.conf).

My application depends on some data pulled from third party APIs. I store the (processed) data in Redis. My problem is, after reboot I lose the data. I guess I need to specify in config file that the data should be persisted on reboot, but I couldn't find the config file. Do I need to create the config file? Are there some templates to use? My goal is just to have the data persisted after reboot.

Thank you!

giliev
  • 2,938
  • 4
  • 27
  • 47

3 Answers3

10

Use dpkg -L redis-server | grep redis.conf to find config file path. It should be located at /etc/redis/redis.conf as I know.

Redis has 2 methods for persistense: Snapshotting and Append-only file:

  • Snapshotting will be enabled by adding (or uncommenting) save X Y in config file. It means Redis will automatically dump the dataset to disk every X seconds if at least Y keys changed. There could be more than one save options in config file.

  • Append-only file will be enabled by adding (or uncommenting) appendonly yes in config file

5

you should turn on the rdb or aof.

see https://redis.io/topics/persistence

Mobility
  • 3,117
  • 18
  • 31
0

Add this to the config file.

appendonly yes

This will append data as you store new data. This enables durability.

Srini Sydney
  • 564
  • 8
  • 17
  • Do I need to create the config file? I couldn't find in my file system a file named redis.conf. – giliev May 15 '17 at 07:03
  • config file is present by default. just edit it. path of config file : redis-server /etc/redis.conf – Srini Sydney May 15 '17 at 11:40
  • This will enable aof persistence which may or may not be the mode you want. Depending on your durability and performance needs you may want to use RDB persistence. – Tague Griffith May 15 '17 at 18:56