Tyk.store_data with Redis (tutorial with docker example) not persistent?

I’m using Custom Python plugin and I would like to store some key value into the Redis DB that had been setup together with the gateway as per the docker instruction.

I am able to save data through tyk.save_data() but it seems that the data does not persist once I restart the server instance through “docker.compose up”. How do it make the value saved permanently?

Hi,

This is about making your redis storage persistent. Mostly that’s done by mapping an external directory into your redis container using a volume.

The redis image at Docker has some suggestions about persistence.

It might be helpful to have a look at tyk-pro-docker-demo/docker-compose.yml at master · TykTechnologies/tyk-pro-docker-demo · GitHub if you’re unfamiliar with docker volumes. That compose file uses volumes to provide persistence to both redis and mongo, but this can be a nuisance too since you can’t start from scratch so easily.

Cheers,
Pete