aerospike / aerospike-server.docker

Dockerfiles for Aerospike Server
Other
141 stars 68 forks source link

Automatically load database dump at container startup #44

Closed supasteev0 closed 3 years ago

supasteev0 commented 3 years ago

Hi,

I would like to know if there would be a way to start the aerospike-server container and automatically restore a dump after the server has started. My goal is to provide an easy way for developers to start the container with a dump from staging or production (mounted as volume or burnt into a custom image), so that they can work locally with a dataset from one of these environment.

I have not find anything in the entrypoint that could make this possible. I know that official Postgresql or mongodb images provide this kind of feature, as you can run a script or load a dump that is located in a folder like /docker-entrypoint-initdb.d. The script is run after the server is started so that you can automate any task, such as a database restore, create users , etc ..., when the container starts.

Is a feature like this planned in the future ? Or could you provide some guidance in order to achieve this ?

Thank you for your help

volmarl commented 3 years ago

This is more of a docker automation in running a script post startup. This could be a shell script that runs asbackup and asrestore inline. Please see Section 5-3:

https://discuss.aerospike.com/t/how-to-migrate-aerospike-from-one-cluster-to-another/1281

and

# Example
asbackup -h SOURCE_NODE_IP -n NAMESPACE_NAME --outputfile - | asrestore -h TARGET_NODE_IP --inputfile - --unique

More details on asrestore options that could be run from within the container.

https://www.aerospike.com/docs/tools/backup/asrestore.html