Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems
Linux

MySQL replication dies with ERROR 1201 (HY000): Could not initialize master info structure

Posted by Admin • Friday, February 12. 2010 • Category: Linux

On a fine happy morning I am greeted with an alert that slave is not running. Running start slave yields this:
ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log
Enabling the log yielded nothing. Googling yielded This Page that helped me a lot, but I didn't have to do quite as much work all over again. Here is what I did.

  1. First, I saved my "SHOW SLAVE STATUS\G" output:
    ************************** 1. row **************************
                 Slave_IO_State:
                    Master_Host: 127.0.0.1
                    Master_User: replication
                    Master_Port: 3307
                  Connect_Retry: 60
                Master_Log_File: mysqld-bin.000401
            Read_Master_Log_Pos: 98
                 Relay_Log_File: mysqld-relay-bin.006135
                  Relay_Log_Pos: 242
          Relay_Master_Log_File: mysqld-bin.000401
               Slave_IO_Running: No
              Slave_SQL_Running: No
                Replicate_Do_DB:
            Replicate_Ignore_DB:
             Replicate_Do_Table:
         Replicate_Ignore_Table:
        Replicate_Wild_Do_Table:
    Replicate_Wild_Ignore_Table:
                     Last_Errno: 0
                     Last_Error:
                   Skip_Counter: 0
            Exec_Master_Log_Pos: 98
                Relay_Log_Space: 0
                Until_Condition: None
                 Until_Log_File:
                  Until_Log_Pos: 0
             Master_SSL_Allowed: No
             Master_SSL_CA_File:
             Master_SSL_CA_Path:
                Master_SSL_Cert:
              Master_SSL_Cipher:
                 Master_SSL_Key:
          Seconds_Behind_Master: NULL
    1 row in set (0.00 sec)
    
  2. Next I followed instructions from the blog I mentioned above:
    STOP SLAVE; RESET SLAVE;
  3. Instead of fully reconfiguring I simply tried to start slave. This is a bad idea because it seems to just try to start slaving off the front of the first binlog file it finds, getting conflicts (or worse).
  4. So I tried something simple:
    mysql> CHANGE MASTER TO MASTER_LOG_POS=98 , MASTER_LOG_FILE = 'mysqld-bin.000401';
    Query OK, 0 rows affected (0.04 sec)
    
    mysql> start slave;
    Query OK, 0 rows affected (0.00 sec)
    
        
    The position comes from the output I saved before

It's working fine again. Still don't know what caused this - possibly random remote server power cycling...

0 Trackbacks

  1. No Trackbacks

2 Comments

Display comments as (Linear | Threaded)
  1. dude you are awesome..thanks alot

  2. You just saved me a lot of time and a lot of Advil. Thanks!

Add Comment


You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
Markdown format allowed


Submitted comments will be subject to moderation before being displayed.