Promote slave server to master if master crashes

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Promote slave server to master if master crashes

Postby rustynail » Wed Jan 13, 2021 8:16 pm

Hi,

- ViciBox v.7.0.4-170113

Master DB server of our cluster has crashed and I have did following to promote slave server to master role:

0. Stopped slave on slave server.
1. Edited astguiclient.conf and changed VARDB_server to localhost
2. Changed VARactive_keepalives to 123456789E
3. On other servers changed VARDB_server to point to slave server

This is first time I am promoting slave to master role. I have checked agent login is fine and will further test but want to make sure if the above steps I took are fine or there is something I am missing? For example I have used "stop slave" to stop slave on this server but after reboot what will happen and how to stop slave permanently on this server?

Please let me know if any further steps need to be taken as this cluster is in production.

Thanks
rustynail
 
Posts: 74
Joined: Mon Nov 21, 2016 6:21 pm

Re: Promote slave server to master if master crashes

Postby carpenox » Thu Jan 14, 2021 8:28 am

I would imagine you need an answer pretty fast so i will reply, but i have never done this myself so this is just in theory as you wait for other responses, Bill or Matt would be the people I would listen to for that answer, but in the meantime, I would backup the database on the main db server if you can because i am not sure if the slave copies all reports and then import that into the slave as a final step but other that it looks good to me
Alma Linux 9.4 | SVN Version: 3889 | DB Schema Version: 1721 | Asterisk 18.21.1 | PHP8
www.dialer.one -:- 1-833-DIALER-1 -:- https://linktr.ee/CyburDial -:- WA: +19549477572
GC: https://join.skype.com/ujkQ7i5lV78O | DC: https://discord.gg/DVktk6smbh
carpenox
 
Posts: 2423
Joined: Wed Apr 08, 2020 2:02 am
Location: St Petersburg, FL

Re: Promote slave server to master if master crashes

Postby mflorell » Thu Jan 14, 2021 9:23 am

We usually just change the IP address of the slave to the master, disable slave mirroring on the slave and reboot the slave while also shutting down the master to analyze off-line.

Once the old master is fixed or replaced, you do a dump of the DB from the current acting master and reverse the process above.

Of course it's different for every kind of DB setup. We have clients with multiple slave DB servers that require a bit more configuration changes for the switchover, and we have some clients that have all of these steps automated as well.
mflorell
Site Admin
 
Posts: 18384
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Promote slave server to master if master crashes

Postby williamconley » Mon Jan 18, 2021 5:43 pm

Remember to change your slave server to read/write if it was in read-only mode.

Check to be sure your master and slave servers had the exact same version of mysql if you intend to swap their roles. You can not have a Master MySQL with more recent version that the slave, as it could execute a command the slave does not recognize (and it may not be immediate, so you could get a false sense of security ...).
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20256
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Promote slave server to master if master crashes

Postby rustynail » Fri Jan 22, 2021 5:53 am

Thank you all for your valuable feedback
I took below steps as it was almost weekend and master server had drives crashed so no data was recoverable.

1. Stopped slave service on slave server.
2. Edited astguiclient.conf and changed VARDB_server to localhost
3. Changed VARactive_keepalives to 123456789E
4. On other servers changed VARDB_server to point to previous slave server. (now acting as master)

It has been working fine since then and after few days when original DB server was reinstalled with new drives then I added it in cluster as a Slave+WEB+TEL server.
The only thing I would like to know is now after reboot slave service starts automatically and when I run "show slave status" on new promoted master I see slave is trying to connect to original master but timesout as original master is no more there.

https://imageupload.io/s7vg47iPk9.i

What will be the best way to stop slave service as now its a master DB?

Cheers!
rustynail
 
Posts: 74
Joined: Mon Nov 21, 2016 6:21 pm


Return to Support

Who is online

Users browsing this forum: Google [Bot] and 116 guests