About the problem of the sudden downmachine of the mysql master from one of the parties.

I know that mysql master and slave have been configured, but I don"t know what to do if one of them dies:

1. If there is only one master and one slave, do you want to upgrade the master manually in case the master dies? (it seems that you can"t call the master library at this time, because if you lose the master and slave, you will change the single library.)
2. What if the slave failed? The data was originally read from the slave database, but now the slave is dead, can you read the master automatically? Is this an php code implementation or how does the server switch automatically?
3. If one master has more than one slave, and the master is dead, how can one of them be upgraded from master to master? Is it manual or automatic? what technology can be used automatically? is it OK to configure the configuration file?
4. If you have one master, you are afraid that the master will die. If you set up two masters, one of them will be used as a backup (is there any such thing)? When the master in use is dead, the other master is automatically enabled immediately. How can this be achieved? do you need to rely on what the third party does, or just configure the configuration file directly? Or do you need to do it manually?
5. Besides, are many people using marriadb instead of mysql these days? Can marriadb completely replace mysql?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdc1da-3967b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdc1da-3967b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?