HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlModerate

How to change a MySQL previous slave to be a master and remove slave status information?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
previousslavestatusremovemysqlmasterhowandchangeinformation

Problem

I have a master -> slave configuration where the master failed. I've been able to reset the old-slave to be a master and the old-master to slave from it. Fine.

What I can't seem to do is to remove the master information on the old-slave which is now the new-master. I see:

mysql> show slave status \G
*************************** 1. row ***************************
           Slave_IO_State: 
              Master_Host: 10.1.2.101
              Master_User: replicationSlave
              Master_Port: 3306
              ...
              Slave_IO_Running: No
              Slave_SQL_Running: No


I've read a lot of MySQL documentation but I still haven't found a way to clear the slave information from the new-master. I've tried:

  • RESET SLAVE which does not seem to clear those settings. [[Actually it does remove the master.info file but not the memory settings. See below.]]



  • CHANGE MASTER TO MASTER_HOST='' which just spits on an error since it was deprecated recently.



  • Checking my.cnf which does not have the master information since they were added programmatically.



  • RESET MASTER because some mysql docs recommended it. That only resets the bin logs.



  • Poking around in the internal MySQL tables to see if I can find the fields to clear.



What is the proper way to do this on MySQL ~5.5.9? Thanks for any help.

Edit:

So it turns out that RESET SLAVE removes the master.info file as @RolandoMySQLDBA implied. However, you still need to restart the server before the slave information is removed.

Is there any way to remove this slave information without having to restart mysqld?

Solution

In MySQL 5.5.16 and later, you can use RESET SLAVE ALL to do all that RESET SLAVE does and reset the connection parameters from the memory, this way it doesn't require a mysqld restart.

Context

StackExchange Database Administrators Q#21087, answer score: 14

Revisions (0)

No revisions yet.