"Error: datadir must be specified" while restoring full database backup

  1. I am trying to restore backup using “innobackupex --copy-back /backup-path” but I get this output:
    ##########
    161123 06:04:09 innobackupex: Starting the copy-back operation

IMPORTANT: Please check that the copy-back run completes successfully.
At the end of a successful copy-back run innobackupex
prints “completed OK!”.

innobackupex version 2.4.4 based on MySQL server 5.7.13 Linux (x86_64) (revision id: df58cf2)
Error: datadir must be specified.
#########

My my.cnf file is not in /etc/my.cnf location but at some other location. So bascially innobackup is not able to read my.cnf file.
When I create a soft link from /etc/my.cnf to my actual my.cnf file the backup works fine.

But otherwise it gives and error.
I have also tried giving “–defaults-file=/path-to-my.cnf” which taking a the backup but it still doesnt work.
Can someone tell me where does innobackupex read the configuration information from, while doing restore. The backup-my.cnf doesnt seem to have enough information in it.

  1. I also get below line in the output of “innobackupex --apply-log”. Is that a normal?

###########
InnoDB: The log sequence number 1631642 in the system tablespace does not match the log sequence number 30237230 in the ib_logfiles!
###########

I have attached my “backup” and “apply-log” outputs. I am new to Xtrabackup and am in the process of evaluating this for our company. Any help in this regard highly appreciated.

innobkp apply log.txt (4.98 KB)

innobkp backup log.txt (17.7 KB)

I had the same error after updating to version 2.4.5, turns out it was a combination of two things:

  1. You need to make sure that --defaults-file is listed first
  2. I had to make sure that the filename for --defaults-file is “my.cnf” not “backup-my.cnf” or anything else, after that it worked.

example:

innobackupex --defaults-file=“/path-tofile/my.cnf” --copy-back /restore-target

Hope this helps, I couldn’t find anything online about that, and on the older version it didn’t matter what order you up the options in.