这篇文章主要讲解了“xtrabackup远程备份的方法教程”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“xtrabackup远程备份的方法教程”吧!
专注于为中小企业提供成都做网站、成都网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业富平免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了成百上千企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
生产环境中常常将数据库备份至远程服务器,本次测试中,数据库服务器:192.168.8.50,远程备份中心:192.168.8.63
1、配置SSH秘钥认证
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub MySQL@192.168.8.63
2、使用tar进行备份并以时间对备份进行命名
/usr/local/xtrabackup/bin/innobackupex --defaults-file=/etc/my.cnf --user=root --password=mysql --port 3306 --socket=/tmp/mysqld.sock --stream=tar ./ | ssh mysql@192.168.8.63 \ "cat - > /backup_center/$(date +%Y-%m-%d_%H:%m:%S).tar" 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/user_bak.frm to180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/time_zone.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/help_relation.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/time_zone_transition_type.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/help_topic.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/db.MYD to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/slow_log.CSM to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/slow_log.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/general_log.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/slave_relay_log_info.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/tables_priv.MYI to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/ndb_binlog_index.MYD to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/slave_master_info.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/func.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/proc.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/time_zone_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/func.MYD to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/procs_priv.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/tables_priv.MYD to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/columns_priv.MYI to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/general_log.CSM to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/ndb_binlog_index.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/gtid_executed.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/procs_priv.MYD to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/func.MYI to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/help_keyword.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/columns_priv.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/proxies_priv.MYI to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/proc.MYI to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/time_zone_transition.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/time_zone_leap_second.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/general_log.CSV to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/servers.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/help_category.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/proxies_priv.MYD to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/event.MYD to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/engine_cost.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/user.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/ndb_binlog_index.MYI to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/db.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/plugin.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/user.MYI to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/columns_priv.MYD to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/innodb_table_stats.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/innodb_index_stats.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/event.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/slow_log.CSV to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/db.MYI to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./mysql/user.MYD to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_transactions_history.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_waits_history.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_summary_by_digest.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/hosts.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/prepared_statements_instances.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/rwlock_instances.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/threads.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/setup_objects.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/objects_summary_global_by_type.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/replication_connection_status.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_summary_by_thread_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/memory_summary_by_host_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_summary_by_host_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/session_variables.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/replication_group_member_stats.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/setup_actors.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/memory_summary_by_account_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_transactions_history_long.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/users.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/setup_consumers.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_stages_history_long.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_waits_summary_global_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_summary_by_program.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/file_instances.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/table_handles.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/variables_by_thread.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/memory_summary_global_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_transactions_summary_by_user_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/table_io_waits_summary_by_index_usage.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_transactions_summary_global_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/status_by_host.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_waits_summary_by_thread_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_stages_summary_by_account_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/session_connect_attrs.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/status_by_account.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/metadata_locks.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_transactions_summary_by_host_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_history_long.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/global_variables.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/table_lock_waits_summary_by_table.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/mutex_instances.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/session_status.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_transactions_summary_by_account_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_stages_summary_by_user_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/table_io_waits_summary_by_table.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_current.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_stages_current.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/replication_connection_configuration.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/memory_summary_by_thread_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/status_by_thread.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/replication_applier_status_by_worker.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/cond_instances.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/performance_timers.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_summary_global_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/accounts.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/session_account_connect_attrs.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_waits_summary_by_instance.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/setup_instruments.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_waits_summary_by_user_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_waits_current.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_stages_summary_by_thread_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_waits_history_long.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/global_status.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/replication_group_members.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_stages_summary_by_host_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/replication_applier_status_by_coordinator.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/file_summary_by_instance.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_transactions_current.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/socket_summary_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/db.opt to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/socket_instances.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_stages_summary_global_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/setup_timers.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/host_cache.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_waits_summary_by_account_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_history.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_transactions_summary_by_thread_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/user_variables_by_thread.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/file_summary_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_summary_by_user_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_stages_history.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/replication_applier_status.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_statements_summary_by_account_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/socket_summary_by_instance.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/status_by_user.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/memory_summary_by_user_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/events_waits_summary_by_host_by_event_name.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 [01] Streaming ./performance_schema/replication_applier_configuration.frm to 180809 16:23:53 [01] ...done 180809 16:23:53 Finished backing up non-InnoDB tables and files 180809 16:23:53 [00] Streaming 180809 16:23:53 [00] ...done 180809 16:23:53 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS... xtrabackup: The latest check point (for incremental): '3504097424' xtrabackup: Stopping log copying thread. .180809 16:23:53 >> log scanned up to (3504097433) 180809 16:23:53 Executing UNLOCK TABLES 180809 16:23:53 All tables unlocked 180809 16:23:53 [00] Streaming ib_buffer_pool to 180809 16:23:53 [00] ...done 180809 16:23:53 Backup created in directory '/backup/full_backup/' MySQL binlog position: filename 'mysql-bin.000013', position '154' 180809 16:23:53 [00] Streaming 180809 16:23:53 [00] ...done 180809 16:23:53 [00] Streaming 180809 16:23:53 [00] ...done xtrabackup: Transaction log of lsn (3504097424) to (3504097433) was copied. 180809 16:23:53 completed OK!
3、登录备份服务器查看备份文件
[root@oneproxy backup_center]# ll total 3683656 -rw-rw-r-- 1 mysql mysql 3772058112 Aug 9 16:24 2018-08-09_16:08:13.tar
感谢各位的阅读,以上就是“xtrabackup远程备份的方法教程”的内容了,经过本文的学习后,相信大家对xtrabackup远程备份的方法教程这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!