Owncloud database setup


#1

I wonder if someone can point me in the right direction, I RTFM and I search before asking for help. I’m trying to install owncloud in a scalable HA environment - i.e. a farm that has redundancy, each server may/may not have certain bits of software. The latest stumbling block that I’m hitting is that I have a mysql/galera cluster, so want to define a comma separated list of dbhosts in the config.php so that owncloud will try to connect to the first on the list, if that fails to move down the list, if that fails, next one...etc. Is that possible or can someone offer suggestions on how I can setup something to do this?


#2

AFAIK you can't add multiple database hosts to the dbhost option in the config.php (the config.sample.php would show the opposite if that would be possible).

However the following documentation shows some notes about a Galera cluster setup for HA:

https://doc.owncloud.org/server/10.0/admin_manual/installation/deployment_recommendations.html

and all ownCloud instances are pointing to the master of this cluster. So i guess this would be the way to go for your environment?


#3

Thanks for the reply! The diagram actually shows that the webservers connect to both the master and slaves (which is what I need), but neither the mid/large diagram description says how when you read the words. I actually think that the diagram is wrong as the only way I can see it working is that the DB servers are accessed through a HAproxy to provide redundancy. Is my thinking wrong?

Unfortunately for me, I want to have a DB on each webserver so that a local instance is tried first before trying another DB instance (for situations where someone may shut down the database but the webserver is left running rather than the whole server going bang). I'm not experienced enough to somehow get HAproxy to decide which instance to connect to do this.

Perhaps I should put this on future requests to be built (as lets face it to specify an array of servers to connect to wouldn't be difficult - they already do it for cache).


#4

Also if HAproxy was used, the traffic would go out from the webserver, through the HAproxy server back to the webserver which is wasteful.


#5

Looks like you're right in this case:


#6

After a bit of thought and a little digging...

I could set something up to have an entry in the local hosts file of each webserver that points a name to an IP (putting the name in the dbhost owncloud entry) and have something that pings the database servers and would swap that entry if it detects failure (and possibly flush dns cache). But it looks like mysql router (http://mysqlhighavailability.com/easy-load-balancing-and-high-availability-using-mysql-router/) can do this (or mysql proxy) for me.