简体   繁体   中英

Save data generated from a Python app running in Docker swarms in Mysql Database

I would like to run multiple instances of my Python app using Swarm in Docker, running on two raspberry Pi. The app communicates with a Mysql db. I would like to save all the data generated from the replicas in one common database but I cannot figure out what is the best way to do that. Should I use docker also for the database or should I try using a DB saved in one host? Any suggestion would be really appreciated!

You can use Docker to your DB or install it directly in the host machine, that's up to you. If you use Docker, make sure that you use a volume to store persistently your DB data.

Personally, I recommend you to install it in the host, but there are different opinions about that topic. Take a look to this Percona blog article: https://www.percona.com/blog/2016/11/16/is-docker-for-your-database/

You should take a look to Galera Cluster for MySql too ( http://galeracluster.com/products/ ). I think that you'd like to have your data replicated to guarantee high avaliability and improve safety of your data.

Hope this helps, good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM