1

I'm trying to set up mysql replication by making lvm snapshot of master datadir and copying it to slave.

The procedure is quite simple, on master server I execute "FLUSH TABLES WITH READ LOCK" and on second terminal making lvm snapshot with lvcreate -l40%FREE -s -n mysql-backup /dev/MySQL/mysql, after that unlock tables.

Next I mount the snapshot and copy datadir to slave, but mysql is failing to start with errors :

150105 12:50:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150105 12:50:53 [Warning] Changed limits: max_open_files: 1024  max_connections: 100  table_cache: 457
150105 12:50:54 InnoDB: The InnoDB memory heap is disabled
150105 12:50:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150105 12:50:54 InnoDB: Compressed tables use zlib 1.2.7
150105 12:50:54 InnoDB: Using Linux native AIO
150105 12:50:54 InnoDB: Initializing buffer pool, size = 3.9G
150105 12:50:54 InnoDB: Completed initialization of buffer pool
150105 12:50:54 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 29552065932592
150105 12:50:54  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Error: trying to add tablespace 210146 of name './somedatabase/CRM_printers.ibd'
InnoDB: to the tablespace memory cache, but tablespace
InnoDB: 210146 of name './somedatabase/status.ibd' already exists in the tablespace
InnoDB: memory cache!
150105 12:50:55 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

I checked and the files of that tables exists. So next I started database with innodb_force_recovery=1 and mysql after that started with many errors like this:

InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Error: trying to add tablespace 210146 of name './db/k.ibd'
InnoDB: to the tablespace memory cache, but tablespace
InnoDB: 210146 of name './db/y.ibd' already exists in the tablespace
InnoDB: memory cache!
InnoDB: innodb_force_recovery was set to 1. Continuing crash recovery
InnoDB: even though the tablespace creation of this table failed.
InnoDB: Error: trying to add tablespace 210235 of name './db/a.ibd'
InnoDB: to the tablespace memory cache, but tablespace
InnoDB: 210235 of name './db/ty.ibd' already exists in the tablespace
InnoDB: memory cache!
InnoDB: innodb_force_recovery was set to 1. Continuing crash recovery
InnoDB: even though the tablespace creation of this table failed.
InnoDB: Error: trying to add tablespace 210285 of name './db/PC.ibd'
InnoDB: to the tablespace memory cache, but tablespace
InnoDB: 210285 of name './portal/HR.ibd' already exists in the tablespace
InnoDB: memory cache!

Now I'm running mysqlcheck -A on this database, and there is an output saing that some of tables doesnt exist, but the frm and idb files exist.

What is the problem is this something wrong with my snapshot?

  • Are you trying to perform the procedure outlined at this page? dev.mysql.com/doc/refman/5.6/en/tablespace-copying.html – Joe Jan 5 '15 at 13:27
  • No I'm not. It's more like cold backup but from lvm snapshot. – B14D3 Jan 5 '15 at 13:46
  • is this using the same my.cnf file? – Mike Jan 5 '15 at 14:30
  • no the servers has different amount of RAM so there are some diferences, for examples innodb_buffer_pool_size – B14D3 Jan 5 '15 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.