Search code examples
dockerredisearch

How do I make redisearch docker image persist data?


I'm using redislabs redisearch docker image locally for working with redisearch, but I would like the created indexes and documents still be there after restarting the redisearch container. I tried volume mapping - it didn't work. What did you do to make it persist?


Solution

  • You have not set the persistence configuration directives, so no data is persisted.

    You can either provide a configuration file, or provide them as command line arguments. For example, the following activates RDB snapshot per the defaults:

    $ docker run -p 6379:6379 -v /tmp/data:/data redislabs/redisearch --loadmodule /usr/lib/redis/modules/redisearch.so --save 3600 1 300 100 60 10000
    

    Regardless, you can verify that the mount has succeeded and manually save the RDB with a call to BGSAVE. You should be able to see the 'dump.rdb' at your host.