Mysql master and slave

Hi

I need to know if there is a way to have nextcloud use a slave database that is local to do all the reads but send any write commands to the master.

My test config is: HA proxy into 3 web severs, all three severs store data in a common SAS unit. Got all this working already.

My problem is i want to add a mater database on its own server, and have a copy of the server in the form of a slave on each of the web servers. The master database server will also serve as the REDIS box for all the web servers as a file locking cache system.

So is there a way to specify that write commands only go to the Master and all read commands go to the local slave.

Possible added complications: I have 2 separate domain names with separate instances of nextcloud, so the reason for this is to allow domain 1 to store all the database information in one database and domain 2 to use the same database but store everything under a different database name. so then the config will be for domain 1 HA proxy - number of web servers-common database and the the same for domain 2 each on separate address ranges and on different servers.

Can anyone help with this.

Grant