xtrabackup: Error: Please set parameter 'datadir' Encountered on Remote Backup Setup

Hi,

I’ve been following a guide to setup a remote backup process using innobackupex command to backup a MASTER’s database from a script run by the SLAVE server.
I created a user “backupuser” on the MASTER server to run the innobackupex command, but i’m stuck with this error

xtrabackup: Error: Please set parameter 'datadir'
innobackupex: Error: The xtrabackup child process has died at /usr/bin/innobackupex line 2579.

[COLOR=#B22222]It seems that if i try to run the innobackupex command but not as root, it can’t/won’t find the datadir. I tried using xtrabackup_55 to manually set the datadir and even the defaults-file but to no avail.

Both SLAVE and MASTER are using Percona-Server 5.5, and I’ve already setup the backupuser’s sudo access to /usr/bin/innobackupex-1.5.1 /usr/bin/innobackupex /usr/bin/xtrabackup /usr/bin/xtrabackup_55/ /usr/bin/xtrabackup_56 so that it won’t need to ask the password.

I’m hoping if anyone can give me a heads up of what i’m missing as I can’t just randomly change my permission for this user, since it’s an active test server. TIA

P.S this the my.cnf of the MASTER server if it helps,

[client]
# CLIENT #
user = root
password = root


[mysqld]
# GENERAL #
server_id = 3301

# DATA STORAGE
datadir = /var/lib/mysql

# BINARY LOG
log-bin = mysql-bin
expire_logs_days = 14
sync_binlog = 1

# REPLICATION #
binlog-format = row

# SAFETY #
max_allowed_packet = 16M
max_connect_errors = 1000000
skip-host-cache
skip-name-resolve
innodb_strict_mode = 1

# CACHES AND LIMITS #
max_connections = 800
tmp_table_size = 32M
max_heap_table_size = 32M
thread_cache_size = 50
table_definition_cache = 4096
table_open_cache = 4096

# INNODB #
innodb_flush_log_at_trx_commit = 1
innodb_file_per_table = 1
innodb_flush_method = O_DIRECT
innodb_buffer_pool_size = 8G

AND this is the guide i was trying to follow… [URL]stevecoug (Steve Meyers) · GitHub

Hi paacharon3;

Try using the --defaults-file option to point innobackupex at your my.cnf and see if that helps.

If that does not work, it may be a permissions issue. So from your backup server, SSH to the master as the backup user you created, and attempt to run innobackupex through sudo like you are attempting to do via the scripted method and see if that works.

-Scott

Hi Scott,

I tried using the --defaults-file option to point it to the my.cnf file and it still did not know the data dir… but it was actually a permissions issue,

I resolved it by allowing the backupuser in the suoders file via visudo and used sudo command as you said, and it’s now working. thank you for your help!

Hi paacharon3;

No problem, glad you got it going. =)

-Scott