0

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!

Giada Confortola
  • 171
  • 1
  • 2
  • 10

1 Answers1

0

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!

kstromeiraos
  • 4,659
  • 21
  • 26
  • Thank you for the answer. I tried to use a galera cluster but I seems it does not work on the arm architecture of the raspberry. If I install the database on the host how can it be reached by containers in different machines? Or should I have a database in each machine? – Giada Confortola May 08 '17 at 06:30