In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
#! / bin/bash
# =
# FileName: MySQLBackup.sh
# Desc: MySQL Databases backup tool.
# Author: chenzm
# Email:969113439@qq.com
# HomePage: http://chenzm0592.blog.51cto.com/
# Version: 0.0.1
# LastChange: 2013-11-15 09:16:39
# History:
# =
Cd / opt/MySQLBackup
. / etc/profile
USERNAME='root'
PASSWORD='password'
U_ID=0
GalliID =
# set mysqldump parameters
MYSQLDUMP= "mysqldump-opt-default-character-set=utf8-skip-lock-tables-C"
# set compression parameters to read from stdin
COMPRESS= "gzip-9"
# set the suffix name of the compressed file, which corresponds to the compression parameter
COMPRESS_EXT= "gz"
DATE=$ (date +% Y-%m-%d)
Mkdir-p logs/
# define log input
Function log () {
# echo-ne ${1}
Echo-ne ${1} > > logs/backup-$ {DATE} .log
}
# minutes and seconds when calculating characters
Function charDate () {
DATE=$1
If [${DATE}-lt 60]; then
Echo "${DATE} seconds"
Elif [${DATE}-ge 60] & & [${DATE}-lt 3600]; then
Echo "$((DATE/60)) minutes $((DATE%60)) seconds"
Else
Masking $((DATE%3600))
Echo "$((DATE/3600)) hour $((M DATE/3600 60)) minutes $((M% 60)) seconds"
Fi
}
TIME_HOST_START=$ (date +% s)
Retry=0
While:
Do
Data=$ (mysql-u$ {USERNAME}-p$ {PASSWORD}-h IP-e 'SHOW DATABASES' 2 > & 1)
If [$? = = 0]; then
Break
Elif [${retry}-ge 5]; then
Log "failed to connect to the database. Exit.\ n"
Exit 1
Fi
((retry++))
Done
DBS=$ (echo ${data} | awk 'BEGIN {split ("test | information_schema", arr, "|"); for (i in arr) b [arr [I]]} END {for
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.