zoukankan      html  css  js  c++  java
  • xtrabackup备份

    #!/bin/bash

    #xtrabackup流式压缩热备份
    #预配置SSH免密码登陆并确认通过

    #远程IP及账户等基础信息
    REMOTE_HOST="192.168.31.101"
    REMOTE_HOST_SSH_PORT="22"
    REMOTE_DB_USERNAME="root"
    REMOTE_DB_PASSWORD="szyg@123456"
    REMOTE_DB_PORT="3306"

    #本地IP及账户等基础信息
    LOCAL_HOST="192.168.31.100"
    LOCAL_HOST_SSH_PORT="22"
    LOCAL_DB_USERNAME="root"
    LOCAL_DB_PASSWORD="szyg@123456"
    LOCAL_DB_PORT="3306"

    #本地数据库存放路径
    MYSQL_PATH="/data/mysql/data"

    #本地xtrabackup流式备份数据库暂存路径
    BACKUP_PATH="/data/mysql/backup"

    #异地xtrabackup流式备份数据库存放路径
    REMOTE_BACKUP_PATH="/data/mysql/backup"

    ###在远程服务器流式备份表空间,传送本地服务器

    #使用tar格式备份
    #innobackupex --user=${LOCAL_DB_USERNAME} --password="${LOCAL_DB_PASSWORD}" --stream=tar --extra-lsndir=${BACKUP_PATH}/chkpoint /data/mysql/backup/ | gzip | ssh -p${REMOTE_HOST_SSH_PORT} ${REMOTE_HOST} "cat - > ${REMOTE_BACKUP_PATH}/$(date +%F)_full.tar.gz"

    #使用xbstream格式备份
    innobackupex --user=${LOCAL_DB_USERNAME} --password="${LOCAL_DB_PASSWORD}" --stream=xbstream --extra-lsndir=${BACKUP_PATH}/chkpoint /data/mysql/backup/ | gzip | ssh -p${REMOTE_HOST_SSH_PORT} ${REMOTE_HOST} "cat - > ${REMOTE_BACKUP_PATH}/$(date +%F)_full.xbstream.gz"

    增量:

    innobackupex --user=${LOCAL_DB_USERNAME} --password="${LOCAL_DB_PASSWORD}"  --incremental --stream=xbstream --extra-lsndir=${BACKUP_PATH}/chkpoint --incremental-basedir=${BACKUP_PATH}/chkpoint /data/mysql/backup/ | gzip | ssh -p${REMOTE_HOST_SSH_PORT} ${REMOTE_HOST} " cat - >  ${REMOTE_BACKUP_PATH}/$(date +%F)_incre.xbstream.gz"

  • 相关阅读:
    UI层复习笔记
    async 的三大返回类型
    用scikit-learn进行LDA降维
    关于解决python线上问题的几种有效技术
    ASP.NET Core MVC/WebAPi 模型绑定探索
    浅谈 Fragment 生命周期
    vue2.0实践的一些细节
    Linux----------Mysql死锁
    Linux----------容器docker file
    Linux----------常用容器命令
  • 原文地址:https://www.cnblogs.com/lishug/p/13223895.html
Copyright © 2011-2022 走看看