Over mariadb 10.3, it use maribackup instead of xtrabackup for backup.
The below script was made for auto backup using crontab.
================================================================
#!/bin/sh
export LANG=ko_KR.UTF-8
USERID="root"
USERPASS=""
CMD="/mysql/mariadb/bin/mariabackup"
HOST=`hostname`
# send backup result to influxdb
REPO="/usr/bin/curl -i -XPOST http://10.10.10.10:8100/write?db=mysql --data-binary "
PATH=/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/sbin:/root/bin:/mysql/mariadb/bin
export PATH
STIME="$(date -u +%s)"
DTIME="$(date +%F_%H-%M-%S)"
mkdir /data/backup/$DTIME
$CMD --backup --target-dir=/data/backup/$DTIME --user=$USERID --password=$USERPASS --host=localhost --slave-info --compress
RESULT=$?
ETIME="$(date -u +%s)"
ELAPSED="$(( ($ETIME - $STIME)/60 ))"
if (( $RESULT < 1 ))
then
$REPO"mysql_backup,host="$HOST" value=\"백업성공(${ELAPSED}m)\""
else
$REPO"mysql_backup,host="$HOST" value=\"백업실패\""
fi
/bin/find /data/backup/test -maxdepth 1 -type d -ctime +4 -exec rm -rf {} \;
'RDB > MySQL' 카테고리의 다른 글
mysql metalock 관리 (0) | 2019.10.14 |
---|---|
MySQL 테이블 상세내용 확인 (0) | 2019.06.04 |
custom 암/복호화 procedure (0) | 2019.04.19 |
custom mysql 암/복호화 함수 (0) | 2019.04.17 |
mariadb 데이터 암/복호화 (0) | 2019.04.08 |