在给一个新库做备份的时候,遇到了问题,具体报错如下:
备份脚本执行过程如下:
分析师配置文件中有错误,添加了datadir 选项,仍然会报错,仔细检查后发现是没有添加【mysqld】标签
[root@o-db all_2016-06-24]# cat /etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[mysqld] -----------> 这里是发生报错的原因 没有添加这个标签 所以会爆出来有不同的值
datadir=/var/lib/mysql/
添加完成后,备份脚本正常执行
160624 10:57:06 Connecting to MySQL server host: localhost, user: root, password: set, port: 0, socket: /var/lib/mysql/mysql.sock
Using server version 10.1.14-MariaDB
Error: option 'datadir' has different values:
'.' in defaults file
'/var/lib/mysql/' in SHOW VARIABLES
备份脚本执行过程如下:
[root@o-db scripts]# sh -x bak.sh
++ which innobackupex
+ innobackupex=/usr/bin/innobackupex
++ which xtrabackup
+ xtrabackup=/usr/bin/xtrabackup
+ cnf=/etc/my.cnf
+ user=root
+ password=admin
+ backdir=/u01/backup
++ date +%F
+ /usr/bin/innobackupex --defaults-file=/etc/my.cnf --socket=/var/lib/mysql/mysql.sock --ibbackup=/usr/bin/xtrabackup --user=root --password=admin --no-timestamp /u01/backup/all_2016-06-23
160624 10:57:06 innobackupex: Starting the backup operation
IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints "completed OK!".
160624 10:57:06 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/var/lib/mysql/mysql.sock' as 'root' (using password: YES).
160624 10:57:06 version_check Connected to MySQL server
160624 10:57:06 version_check Executing a version check against the server...
160624 10:57:06 version_check Done.
160624 10:57:06 Connecting to MySQL server host: localhost, user: root, password: set, port: 0, socket: /var/lib/mysql/mysql.sock
Using server version 10.1.14-MariaDB
Error: option 'datadir' has different values:
'.' in defaults file
'/var/lib/mysql/' in SHOW VARIABLES
++ date --date '1 days ago ' +%Y-%m-%d
+ rm -rf /u01/backup/all_2016-06-23
分析师配置文件中有错误,添加了datadir 选项,仍然会报错,仔细检查后发现是没有添加【mysqld】标签
[root@o-db all_2016-06-24]# cat /etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[mysqld] -----------> 这里是发生报错的原因 没有添加这个标签 所以会爆出来有不同的值
datadir=/var/lib/mysql/
添加完成后,备份脚本正常执行
xtrabackup: Stopping log copying thread.
.160624 11:09:00 >> log scanned up to (33566075)
160624 11:09:00 Executing UNLOCK TABLES
160624 11:09:00 All tables unlocked
160624 11:09:00 Backup created in directory '/u01/backup/all_2016-06-24'
160624 11:09:00 [00] Writing backup-my.cnf
160624 11:09:00 [00] ...done
160624 11:09:00 [00] Writing xtrabackup_info
160624 11:09:00 [00] ...done
xtrabackup: Transaction log of lsn (33566075) to (33566075) was copied.
160624 11:09:00 completed OK!
++ date --date '1 days ago ' +%Y-%m-%d
+ rm -rf /u01/backup/all_2016-06-23
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29291882/viewspace-2120930/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29291882/viewspace-2120930/