Replication mechanism for Nextcloud for High Availability with Docker Swarm and MySQL

i want to replicate nextcloud application database (MySQL) in docker swarm for improve HA as i know i have two options:

master-slave that is good option for separation of write and read and also easy to config but the problem is when master database is crashed supposedly has no automatic failover mechanism. my problem with this solution are no automatic failover mechanism and no way i think for separation read and write because .env file of nextcloud has just one part for mysql configration not two for read and write and i dont know it is possible or not for seperation

master-master that is good for automatic failover mechanism because all databases are master and switching is fine and if i cant to separate write and read is a good option for me but the problem as i know it is hard to config and Conflict Resolution is hard

im new commer at this . could you give me hint for this and which mechanism is more appropriate?

i want to have high available database