LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-17-2013, 06:27 AM   #1
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Rep: Reputation: 135Reputation: 135
mysql master slave replication error


Hi,

I have a mysql server(version 5.6) on MAC.
And another CentOS 6 box with mysql 5.1.

I did the replication with MAC system DB as master and CentOS as slave.

Everything went well. and these are output of status on both system:


PHP Code:
mysqlshow master status;
+---------------------------------+----------+--------------+------------------+-------------------+
File                            Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set |
+---------------------------------+----------+--------------+------------------+-------------------+
xxxxs-MacBook-Pro-bin.000004 |      120 |              |                  |                   |
+---------------------------------+----------+--------------+------------------+-------------------+
1 row in set (0.03 sec
and on slave
Code:
mysql> show slave status;
+----------------------------------+----------------------+-------------+-------------+---------------+---------------------------------+---------------------+-------------------------+---------------+---------------------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+
| Slave_IO_State                   | Master_Host          | Master_User | Master_Port | Connect_Retry | Master_Log_File                 | Read_Master_Log_Pos | Relay_Log_File          | Relay_Log_Pos | Relay_Master_Log_File           | Slave_IO_Running | Slave_SQL_Running | Replicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignore_Table | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | Last_Error | Skip_Counter | Exec_Master_Log_Pos | Relay_Log_Space | Until_Condition | Until_Log_File | Until_Log_Pos | Master_SSL_Allowed | Master_SSL_CA_File | Master_SSL_CA_Path | Master_SSL_Cert | Master_SSL_Cipher | Master_SSL_Key | Seconds_Behind_Master | Master_SSL_Verify_Server_Cert | Last_IO_Errno | Last_IO_Error | Last_SQL_Errno | Last_SQL_Error |
+----------------------------------+----------------------+-------------+-------------+---------------+---------------------------------+---------------------+-------------------------+---------------+---------------------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+
| Waiting for master to send event | xxxxs-MacBook-Pro | userreplica  |        3306 |            60 | xxxxs-MacBook-Pro-bin.000004 |                 120 | mysqld-relay-bin.000016 |           280 | xxxxs-MacBook-Pro-bin.000004 | Yes              | Yes               |                 | mysql               |                    |                        | mydb.%                  |                             |          0 |            |            0 |                 120 |             436 | None            |                |             0 | No                 |                    |                    |                 |                   |                |                     0 | No                            |             0 |               |              0 |                |
+----------------------------------+----------------------+-------------+-------------+---------------+---------------------------------+---------------------+-------------------------+---------------+---------------------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+
1 row in set (0.00 sec)
PHP Code:
mysqlshow processlist;
+----+-------------+-----------+------+---------+------+-----------------------------------------------------------------------+------------------+
Id User        Host      db   Command Time State                                                                 Info             |
+----+-------------+-----------+------+---------+------+-----------------------------------------------------------------------+------------------+
|  
system user |           | NULL Connect |   12 Has read all relay logwaiting for the slave I/O thread to update it NULL             |
|  
system user |           | NULL Connect |   12 Waiting for master to send event                                      NULL             |
|  
root        localhost NULL Query   |    NULL                                                                  show processlist |
+----+-------------+-----------+------+---------+------+-----------------------------------------------------------------------+------------------+
3 rows in set (0.00 sec
in log its showing:
Quote:
131117 17:22:41 InnoDB: Initializing buffer pool, size = 8.0M
131117 17:22:41 InnoDB: Completed initialization of buffer pool
131117 17:22:41 InnoDB: Started; log sequence number 0 44556
131117 17:22:41 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=mysqld-relay-bin' to avoid this problem.
131117 17:22:41 [Note] Event Scheduler: Loaded 0 events
131117 17:22:41 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.69' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
131117 17:22:41 [Note] Slave SQL thread initialized, starting replication in log 'xxxxs-MacBook-Pro-bin.000004' at position 120, relay log './mysqld-relay-bin.000014' position: 280
131117 17:22:41 [Note] Slave I/O thread: connected to master 'usereplica@xxxxs-MacBook-Pro:3306',replication started in log 'xxxxs-MacBook-Pro-bin.000004' at position 120
So I think replication is happening, but while querying the tables its giving 2 different errors for different tables:
PHP Code:
mysqldesc testdb.user_credentials;
ERROR 1146 (42S02): Table 'testdb.user_credentials' doesn't exist
mysql> desc testdb.user_basic_info;
ERROR 1033 (HY000): Incorrect information in file: '
./testdb/user_basic_info.frm
The tables are there. But why its saying doesnot exist.
PHP Code:
mysqlshow tables;
+----------------------+
Tables_in_testdb   |
+----------------------+
c3p0_test_table      |
testdb_email_id    |
user_basic_info      |
user_contact_details |
user_credentials     |
+----------------------+
5 rows in set (0.00 sec
And the log shows:
Quote:
131117 17:41:33 [ERROR] Cannot find or open table testdb/user_credentials from
the internal data dictionary of InnoDB though the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support.
See http://dev.mysql.com/doc/refman/5.1/...eshooting.html
how you can resolve the problem.

131117 17:41:46 [ERROR] /usr/libexec/mysqld: Incorrect information in file: './testdb/user_basic_info.frm'
I checked the innodb_log_file_size is 48 MB in both master and slave.
So I checked the table is corrupted or not on slave,its saying corrupted:

PHP Code:
mysqlcheck table user_basic_info;
+--------------------------+-------+----------+-----------------------------------------------------------------+
Table                    Op    Msg_type Msg_text                                                        |
+--------------------------+-------+----------+-----------------------------------------------------------------+
testdb.user_basic_info check Error    Incorrect information in file'./testdb/user_basic_info.frm' |
testdb.user_basic_info check error    Corrupt                                                         |
+--------------------------+-------+----------+-----------------------------------------------------------------+
2 rows in set (0.00 sec
But how its corrupted ? Please advice.
 
Old 11-20-2013, 01:56 PM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
I don't really know exactly what is wrong, maybe you could try to repair it. Mysql has a few alternatives for this, here's one link: http://dev.mysql.com/doc/refman/5.1/...ng-tables.html
But I must say I doubt it.
You are replicating from a higher version master to a lower version slave, and not only one major version between but two!
The other way might work - it's not supported, only with one major version difference, but still it could work.
You see, a new version often means changes in database structure, so replication from 5.6 to 5.1 means slave gets data it can't handle.

But I can't be sure of course, sometimes it works the way you do it.
So, you do have a backup of course, take another one before you start repairing.
You could try with mysql's built-in repair tools, I've used them a few times with good result.
Another possibility is to take out a fresh dump of testdb.user_basic_info from master and insertit into slave. Youll have to be careful here, stop mysql check position etc.
And please report back, I'm very interrested in how it goes!
 
Old 12-01-2013, 09:09 PM   #3
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Original Poster
Rep: Reputation: 135Reputation: 135
The issue got resolved. I installed mysql-server the same version as master in the slave and it worked fine without any error.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Setup Master-Slave Replication in MySQL Server LXer Syndicated Linux News 0 06-05-2013 11:23 PM
[SOLVED] Mysql database Master slave replication error SAbhi Linux - Server 1 12-23-2011 03:38 AM
MySQL Master-Slave Replication - How to make the slave read-only? saagar Linux - Server 1 08-31-2010 08:13 AM
MySQL Master-SLave Replication?? linuxshadow Linux - Server 7 06-13-2008 09:22 AM
Multiple Master to one Slave for MySQL Replication Swakoo Linux - General 0 03-31-2007 04:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration