Handling a MySQL slave environment error 1201 (HY000): Could not initialize master info structure case

Source: Internet
Author: User

MySQL>1872tolog from the repository

Handling a MySQL slave environment appears error 1201 (HY000): Could not initialize master info structure case. Cold backup method to copy a new slave, the initialization parameters have been modified in the relevant file path and server_id and other related parameters. However, when you start slave, you find that the following error message appears in Error_log:
120326  One:Ten: at[ERROR]/usr/local/mysql//libexec/mysqld:file '/data/mysqldata/3306/binlog/mysql-relay-bin.000002 ' not Found (errcode:2)120326  One:Ten: at[ERROR] Failed to open log (file '/data/mysqldata/3306/binlog/mysql-relay-bin.000002'Errno2)120326  One:Ten: at[ERROR] Failed to open the relay log'/data/mysqldata/3306/binlog/mysql-relay-bin.000002'(Relay_log_pos126074557)120326  One:Ten: at[ERROR] Could not open logfile120326  One:Ten: at[ERROR] Failed to initialize the masterInfoStructure

Because the new slave changes the service port and file path, the analysis should be due to the mysql-relay-bin.index still keep the old relay log file path, and these paths can not find the appropriate files, so error. For this kind of problem to solve is relatively simple, reset the slave reference, execute the command as follows:
Mysql>Reset Slave; Query OK,0Rows Affected (0.01sec) MySQL>Change Master tomaster_host='10.0.0.101',    master_port=3306,    Master_user='Repl',    master_password='Repl',    master_log_file='mysql-bin.000011',    master_log_pos=1;

ERROR (HY000): File '/data/mysqldata/3306/binlog/mysql-relay-bin.000001 ' not Found (errcode:2) It should still be a mysql-relay-bin.index problem, delete the file and the associated Relay-bin file. Configure Master again:
Mysql>Change Master tomaster_host='10.0.0.101',    master_port=3306,    Master_user='Repl',    master_password='Repl',    master_log_file='mysql-bin.000011',    master_log_pos=1; ERROR1201(HY000): Could not initialize MasterInfoStructure MoreError messages can be foundinchThe MySQL error log

A new error has occurred, follow the prompts to see Error_log also found no more error messages, Error_log only show one:
120326 One::  [ERROR] Error reading master configuration on the OS side view Master/  Slave's configuration file was found to be two 0-byte files:1 mysql mysql     0: Master .  Info1 mysql mysql     0: Relay-log.  Info

Would that be the reason to delete the two files directly and then try to re-run the Change master:
Mysql>Change Master to      -Master_host='10.0.0.101',     -Master_port=3306,     -Master_user='Repl',     -Master_password='Repl',     -Master_log_file='mysql-bin.000011',     -Master_log_pos=1; Query OK,0Rows Affected (0.00Sec

Successful, start slave and view status:
Mysql>start slave; Query OK,0Rows Affected (0.00sec) MySQL>Show Slave Status\g*************************** 1. Row***************************slave_io_state:waiting forMaster toSend event Master_host:10.0.0.101master_user:repl Master_port:3306Connect_retry: -Master_log_file:mysql-Bin.000011Read_master_log_pos:101

........... Fault resolution. Transferred from: http://blog.itpub.net/7607759/viewspace-719707/

Handling a MySQL slave environment error 1201 (HY000): Could not initialize master info structure case

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.