[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Multiple instances (pods) of one Database in OpenShift V3





On Tue, Nov 17, 2015 at 2:46 AM, Lorenz Vanthillo <lorenz vanthillo outlook com> wrote:
Hi,

I'm wondering what will happen when you have multiple instances (pods) of one database running. I don't have a test-environment at the moment so that's the reason I have to ask this.
So for example:
- In the beginning you have one MySQL service with one RC and one pod which contains one running container of mysql. It will use persistent storage.
- I will do some configuration on the DB and add some data. After it, I will scale the existing pod with the help of my RC. Until I have 5 instances running of my database. They are all the same.
--> Q1: Will they contain the same data after the scaling? I would think so.
When I'm connecting the DB to an existing application, I assume that all the instances will contain the same data when I add some data via the application. A broken pod will be rebuild and contain the same data thanks to persistent storage.

​Yes, they're going to share the same persistent volume claim which means they're going to all have the same shared storage mount (this may depend somewhat on your persistence volume filesystem, but it's definitely the case for NFS).  This immediately points to the reason you can't actually scale your DB up this way, because all those instances are going to step on each other trying to access the same files on that shared storage.

To see an illustration of how to scale up mysql, please see:
https://github.com/openshift/mysql/tree/master/5.6/examples/replica

 
--> Q2: What will happen when I access one of the running db-containers and I change some column or add some table?

​Depends on your DB but in the case of mysql, again, sharing the filesystem between running instance is not going to work the way you want it to.​

 
(I'm afraid the change will only be effective on the datbase I accessed)
--> Q3: What will happen when I access one of the running db-containers and I add some data?
(To me it looks pretty the same as Q1 so I think the data will be in every container after that, thanks to persistent storage).


​Again, this is not going to work if all your DB instances are sharing the same files.  You need, at a minimum, separate directories within the shared storage volume, for each instance.  The MySQL example above uses a single master with persistent storage, and then N slave replicas which each use EmptyDir storage meaning each one gets its own private (but non-persistent) storage.  Changes are replicated between them and if a slave fails, it will get a new copy of the DB via replication when it is restarted.  If the master fails, it will re-attach to the persisted storage on restart, retaining the DB content.

 
Thanks

_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users




--
Ben Parees | OpenShift


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]