1

I have this machine as slave. Below is the command I ran and stuck. I done the change on the config file and set the id=2 too. Anything else I am missing here?

slave start; 
ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log 
mysql> change master to MASTER_HOST='192.168.1.15', MASTER_USER='replication1', MASTER_PASSWORD='*******',MASTER_LOG_FILE='mysql-bin.000001'; ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log ?

Below is the results of

show master status\G
*************************** 1. row ***************************
            File: mysql-bin.000001
        Position: 98
    Binlog_Do_DB: fms,sms
Binlog_Ignore_DB:
1 row in set (0.00 sec)


show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.1.15
                  Master_User: replication1
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000001
          Read_Master_Log_Pos: 98
               Relay_Log_File: mysqld-relay-bin.000002
                Relay_Log_Pos: 243
        Relay_Master_Log_File: mysql-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: fms
          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: 399
              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: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
1 row in set (0.00 sec)
newbie14
  • 979
  • 3
  • 18
  • 25

2 Answers2

2

I noticed you did not specify the MASTER_LOG_POS in the CHANGE MASTER TO command.

Another problem could be this:

When you set up MySQL Replication, you have to explicitly set this in /etc/my.cnf

on the master:

[mysqld]
server-id=1

and this on the Slave

[mysqld]
server-id=2

Then CHANGE MASTER TO can work

Since the Master is MySQL 5.0.67 and you loaded the same data into the Slave, here is the CHANGE MASTER TO command you need:

change master to
MASTER_HOST='192.168.1.15',
MASTER_USER='replication1',
MASTER_PASSWORD='*******',
MASTER_LOG_FILE='mysql-bin.000001',
MASTER_LOG_POS=98;

Here is something you need to know fot setting up other slaves

  • The Master must be the same version as the Slave or older.
  • The starting position for any empty Master is
    • 107 for MySQL 5.5
    • 106 for MySQL 5.1
    • 98 before MySQL 5.1

Now you have replication working, take note of the following

  • Relay_Log_Space is 399
  • Exec_Master_Log_Pos is 98

Do the following:

  • Run this command on the Master: CREATE DATABASE rolando;
  • Do SHOW SLAVE STATUS\G on the Slave
  • Do SHOW DATABASES; on the Slave

What results should you have?

  • Relay_Log_Space should be greater than 399
  • Exec_Master_Log_Pos should be greater than 98
  • The database rolando should appear in the SHOW DATABASES; on the Slave

If this happens, congratulations !!! Replication is working !!!

From here, you just have to monitor

  • Slave_IO_Running (make sure it is Yes)
  • Slave_SQL_Running (make sure it is Yes)
  • Seconds_Behind_Master (should be zero, long running queries make it increase until all queries are processed)
RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536
1

Try this possible solutions:

  • delete relay bin file and try

stop slave; CHANGE MASTER TO master_log_file='name_of_current_file_on_master',master_log_pos=4; start slave;

   it will download play again the file
  • just stop your slave by :

STOP SLAVE; then use command to reset your slave:

       CHANGE MASTER TO master_host= 'master_ip or
       hostname',master_user='username eg
       :root'master_log_file='bin.021',master_log_pos=275410644;

       NOTE where master_log_file tells you about the log file of your
       master and the master_log_pos tells about the position from where to
       start the replication .you can get these details by running this
       command on your master:

       show master status\G;
       *************************** 1. row *************************** File:bin.021 Position: 275410644 Binlog_Do_DB: Binlog_Ignore_DB: 1
       row in set (0.03 sec)

       then start your slave once again by :

       START SLAVE: then go for SHOW SLAVE STATUS\G;

   make sure SLAVE_IO_RUNNING and SLAVE_SQL_RUNNING is set to YES
Mahesh Patil
  • 3,078
  • 2
  • 17
  • 23