使用innobackupex远程备份出问题,求解如何远程备份

yeyouweiyang 2015-07-13 10:08:59
各位路过的大哥可以帮我看看问题或者给条可行的可以远程备份的命令,我使用了2条官网给出的可以远程的命令,但是发现都不行,为了避免干扰,备份之前已经把iptables和selinux都关掉了,本地导出备份是正常的,但是一尝试备份到远程主机就出错。

第一条命令:
innobackupex --user=root --password='145690' --stream=tar ./ | ssh root@192.168.0.129 "cat - > /data/backups/backup.tar"
控制台输出如下,这里都没提示让我输入远程主机的密码:

[root@centos databackup]# innobackupex --user=root --password='145690' --stream=tar ./ | ssh root@192.168.0.129 "cat - > /data/backups/backup.tar"

InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.

This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.

Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p

150713 17:56:41 innobackupex: Executing a version check against the server...
150713 17:56:41 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root' (using password: YES).
root@192.168.0.129's password: 150713 17:56:41 innobackupex: Connected to MySQL server
150713 17:56:41 innobackupex: Done.
150713 17:56:41 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root' (using password: YES).
150713 17:56:41 innobackupex: Connected to MySQL server
150713 17:56:41 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!".

innobackupex: Using server version 5.6.25

innobackupex: Created backup directory /data/databackup

150713 17:56:41 innobackupex: Starting ibbackup with command: xtrabackup --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/tmp --innodb_log_file_size="50331648" --innodb_data_file_path="ibdata1:12M:autoextend" --tmpdir=/tmp --extra-lsndir='/tmp' --stream=tar
innobackupex: Waiting for ibbackup (pid=2078) to suspend
innobackupex: Suspend file '/tmp/xtrabackup_suspended_2'

xtrabackup version 2.2.11 based on MySQL server 5.6.24 Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /var/lib/mysql
xtrabackup: open files limit requested 0, set to 1024
xtrabackup: using the following InnoDB configuration:
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 50331648
>> log scanned up to (58238384)
xtrabackup: Generating a list of tablespaces
[01] Streaming ./ibdata1
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)
>> log scanned up to (58238384)



发现会一直卡在 log scanned up to (58238384),我的测试数据库数据量很少, 在本地导出正常情况下是只有几行这个 log scanned up to 就完毕了,之后我又尝试了官网的第二条命令:
ssh root@192.168.0.129 "( nc -l 9999 > /data/backups/backup.tar & )" && innobackupex --user=root --password='145690' --stream=tar ./ | nc 192.168.0.129 9999
控制台输出如下:
[root@centos databackup]# ssh root@192.168.0.129 "( nc -l 9999 > /data/backups/backup.tar & )" && innobackupex --user=root --password='145690' --stream=tar ./  |  nc 192.168.0.129 9999
root@192.168.0.129's password:

InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.

This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.

Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p

150713 17:57:38 innobackupex: Executing a version check against the server...
150713 17:57:38 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root' (using password: YES).
150713 17:57:38 innobackupex: Connected to MySQL server
150713 17:57:38 innobackupex: Done.
150713 17:57:38 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root' (using password: YES).
150713 17:57:38 innobackupex: Connected to MySQL server
150713 17:57:38 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!".

innobackupex: Using server version 5.6.25

innobackupex: Created backup directory /data/databackup
tar: -:无法 write: 断开的管道
tar: Error is not recoverable: exiting now
innobackupex: 'tar chf -' returned with exit code 2.
innobackupex: got a fatal error with the following stacktrace: at /usr/bin/innobackupex line 4921
main::backup_file_via_stream('/tmp', 'backup-my.cnf') called at /usr/bin/innobackupex line 4970
main::backup_file('/tmp', 'backup-my.cnf', '/tmp/backup-my.cnf') called at /usr/bin/innobackupex line 4994
main::write_to_backup_file('/tmp/backup-my.cnf', '# This MySQL options file was generated by innobackupex.\x{a}\x{a}# T...') called at /usr/bin/innobackupex line 3801
main::write_backup_config_file('/tmp/backup-my.cnf') called at /usr/bin/innobackupex line 3728
main::init() called at /usr/bin/innobackupex line 1574
innobackupex: Error: Failed to stream '/tmp/backup-my.cnf': 2 at /usr/bin/innobackupex line 4921.
...全文
861 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhu19774279 2015-09-06
  • 打赏
  • 举报
回复
引用 6 楼 jms007ll 的回复:
现在可以本地备份到远程,请问如何从远程备份到本地?
原理和远程备份一样,调用远程的sh,在远程备份完了,再发送备份结果到本地
jms007ll 2015-08-31
  • 打赏
  • 举报
回复
现在可以本地备份到远程,请问如何从远程备份到本地?
rick-he 2015-08-17
  • 打赏
  • 举报
回复
引用 3 楼 zhu19774279 的回复:
哈哈哈哈,我的帖子总算帮到人了
rickchen1979 2015-08-17
  • 打赏
  • 举报
回复
兄弟们,加我qq:1473497941,求助,我现在的环境,一台机器里面只安装了innobackupex,另一台mysql,想备份,请教
zhu19774279 2015-07-14
  • 打赏
  • 举报
回复
哈哈哈哈,我的帖子总算帮到人了
yeyouweiyang 2015-07-13
  • 打赏
  • 举报
回复
好吧我自己解决了。可参考这篇文章: http://m.blog.csdn.net/blog/zhu19774279/41284635 具体解决方法是安装sshpass显示指定远程主机的密码,sshpass的安装如下:

cd /etc/yum.repos.d/
wget http://download.opensuse.org/repositories/home:Strahlex/CentOS_CentOS-6/home:Strahlex.repo
yum install sshpass
如下命令成功执行: innobackupex --user=root --password=root --stream=tar ./ | gzip | sshpass -p 'root123' ssh root@10.6.32.28 "cat - > /usr/programs/xtraback/backup.tar.gz"
yeyouweiyang 2015-07-13
  • 打赏
  • 举报
回复
没人吗,请求火力支援!!!

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧