# Specify the backup method(s) that will be used.
# tarball: takes a list of directories and builds the corresponding tarballs.
# mysql: archives MySQL databases using mysqldump. To restore the database, you # need to use the same tool manually.
export BM_ARCHIVE_METHOD=“tarball mysql”
# Where to store the backups.
export BM_REPOSITORY_ROOT=“/var/archives”
# The following directive indicates backup-manager to name
# the generated files after the directory that was backed up.
export BM_TARBALL_NAMEFORMAT=“long”
# Define the compression type for the generated files.
export BM_TARBALL_FILETYPE=“tar.gz”
# List the directories that you want to backup.
export BM_TARBALL_DIRECTORIES=“/etc /home /var/log”
# Exclude some subdirectories or file extensions.
export BM_TARBALL_BLACKLIST=“/var/log/myotherapp.log *.mp3 *.mp4”
# List the database(s) that you want to backup, separated by spaces.
export BM_MYSQL_DATABASES=“mysql mybase wordpress dotclear phpbb2”
# MySQL username.
export BM_MYSQL_ADMINLOGIN=“root”
# MySQL password for username.
export BM_MYSQL_ADMINPASS=“mypassword”
# Add support for DROP statements (optional)。
export BM_MYSQL_SAFEDUMPS=“true”
# The hostname or IP address where the database(s) reside.
export BM_MYSQL_HOST=“localhost”
# Port where MySQL server is listening.
export BM_MYSQL_PORT=“3306”
# Compression type (optional)。
export BM_MYSQL_FILETYPE=“gzip”
# Do not archive remote hosts, but only localhost.
BM_TARBALL_OVER_SSH=“false”
# User account for SSH upload.
export BM_UPLOAD_SSH_USER=“root”
# Absolute path of the user‘s private key for passwordless SSH login.
export BM_UPLOAD_SSH_KEY=“/root/.ssh/id_rsa”
# Remote hosts (make sure you have exported your public key to them):
export BM_UPLOAD_SSH_HOSTS=“dev1 dev3”
# Remote destination for uploading backups. If it doesn’t exist,
# this directory will be created automatically the first time
# backup-manager runs.
export BM_UPLOAD_SSH_DESTINATION=“/var/archives/backups/$HOSTNAME”
運行備份管理器
要手動運行備份管理器,請輸入以下命令。你也可以選擇添加‘-v’標(biāo)識以便一步一步詳細(xì)檢查運行過程。
# backup-manager
BM_TARBALL_DIRECTORIES列出的目錄將作為tarball備份到BM_REPOSITORY_ROOT目錄,然后通過SSH傳輸?shù)紹M_UPLOAD_SSH_DESTINATION指定的主機dev1和dev3。
正如你在上面圖片中看到的那樣,備份管理器在運行的時候創(chuàng)建了一個名為/root/.back-manager_my.cnf的文件,MySQL密碼通過BM_MYSQL_ADMINPASS指定。那樣,mysqldump可以驗證到MySQL服務(wù)器,而不必在命令行以明文格式接受密碼,那樣會有安全風(fēng)險。
通過cron運行備份管理器
一旦決定哪一天是進(jìn)行每周備份的最佳日子(最佳時間),你可以讓cron來為你運行備份管理器。
打開root的crontab文件(注意,你必須以root登錄):
# crontab -e
假定你想要在星期天的上午5:15分運行備份管理器,那么就添加下面這行。
1505**0/usr/sbin/backup-manager 》/dev/null2》&1
小結(jié)
上面就是Linux使用backup-manager備份系統(tǒng)的方法介紹了,相對于其他的備份工具,backup-manager更加的簡單易用,是系統(tǒng)備份的好幫手。
發(fā)表評論
共0條
評論就這些咯,讓大家也知道你的獨特見解
立即評論以上留言僅代表用戶個人觀點,不代表系統(tǒng)之家立場