MySQL master-slave after crash - mysql

Here's the scenario:
I have one MySQL Master and 1 slave.
master-slave replication is set and works perfectly.
The slave machine crashes.
The master machine is still up and running.
Nothing changes in the master DB.
I start the slave machine again.
I start the slave MySQL DB.
Do I need to invoke "start slave" again on the slave DB ?
10x.

I believe the slave will start automatically unless you have skip-slave-start in your my.cnf.
Run 'SHOW SLAVE STATUS' and see what it says.

In master, check the status of the master and see it shows slave is running or not.
Goto slave machine and restart(stop & start) the slave machine.
Repeat the step 1 to check again

Related

why mysql not sync system variables from master to slave

I just tried to execute "set global log_queries_not_using_indexes=ON;" on master, but slave not sync the same system variables.
So i'm confused that what does mysql master sync to slave by binlog?
include information_schema?

Mysql replication recovery after Slave Reset

I had MySQL master slave replication configured. I accidently ran Reset Slave on slave instance. I do not have a note of the last bin log position of the master that the slave had completed. Show slave status command returns a blank row as I have reset the slave.
Is there any way in which I can recover the last bin log position that the Slave had finished syncing? Or is there any other way in which I can fix the replication without setting it up fresh?

Mysql Replication slave don't update master mysqld when master mysqld is up after down

i set up mysql replication, the set up goes like this master - slave , when master is up and slave is up the replication is fine. The problem arises when the master is down and i updated the slave (insert, update, delete) records, when the master is back online those update in slave do not replicated in master. Is there any way to update the master after it comes back from offline to online?
tnx

How to reduce MySQL replication delay

I have two MySQL Enterprise servers for master host and slave host. Replication has been setup successfully and works grate.
One day I have to kill query from master and then stop the slave. Then I had skip counter + 1 relay log and start slave again.
Then replication is not done real time and there is a time gap between master and slave.
Seconds_Behind_Master = 12222
How can I reduce this delay.

MySQL Master-Slave-Slave Configuration

Quick questions about MySQL Master-Slave-Slave set-ups:
I currently have a Master-Slave set up right now and I would like to add another slave. Would it be possible to clone the server running the slave, and then spin up a new server with the image from the slave, and have it pick up right where it left off? So whatever the binlog was at the time of the copy it would just run until it catches up with the master?
Ideally - I'm trying to start another slave the connects to the master without shutting down the Master for a backup. Any advice or guidance would be great. Thanks!
Yes, you can shutdown slave instance, and copy all it's data to another slave (including logs).
Don't forget to edit my.cnf on second slave (you should change server-id)
Then start both slave servers
Yes this is possible. The best way would probably be to temporarily pause the replication on the slave, determine the master binary log position information, then make your dump from the replica while replication is still paused (and no other data is changing on the replica). After the dump is complete you can restart the replica.
On the new server, just install the dump, set the binlog coordinates and start up the replication. A word of caution though. Make sure your settings for purging the binary logs on the master will allow for retention of the binary logs for long enough for you to do this set up process and get the new slave caught up before the bin logs are purged.
Here's a good tutorial on how to setup multiple replication slaves for a master server:
http://arcib.dowling.edu/cgi-bin/info2html?%28mysql%29replication-howto
It doesn't explain your scenario, but gives important hints: you must assign a unique server-id to your second slave.
Regarding your problem: If your masters binary log is kept long enough, you should not get into trouble. Just shutdown your slave for a moment, clone it and write down: MASTER_LOG_FILE and MASTER_LOG_POS of the slave; then restart the original slave and setup the second slave correctly: that means with that given MASTER_LOG_POS and *_FILE set and a unique server-id in my.cnf;
Then start up your second slave. Use "START SLAVE" to start the replication and then have a look at "SHOW SLAVE STATUS;"
Regards,
Stefan
PS: Cannot promise this to work, but I'm quit sure it should do.
You can use existing mysql slave to make a new one just do the following steps,
Stop replication on slave.
execute show slave status; and note these values Master_Log_File: master-bin.000002 &
Read_Master_Log_Pos: 1307
Take mysqldump and restore it on new mysql slave server, you can copy my.cnf file from existing mysql slave server and just change server-id.
execute change master to command on new slave server providing details of mysql master server and log file name and log position which we obtained from existing mysql slave.
execute start slave; on existing mysql slave.
to verify slave status run show slave status.
that's it you have a new mysql slave server!!
Good luck !