⑴# 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 pression 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 *.mp *.mp”
⒃# List the database(s that you want to backup, separated by spaces.
⒄export BM_MYSQL_DATABASES=“mysql mybase wordpress dotclear phpbb”
⒅# 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=“”
⒏# pression type (optional。
⒐export BM_MYSQL_FILETYPE=“gzip”
⒑# Do not archive remote hosts, but only localhost.
⒒BM_TARBALL_OVER_SSH=“false”
⒓# User aount 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=“dev dev”
⒙# 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’标识以便一步一步详细检查运行过程。
③# backup-manager
④BM_TARBALL_DIRECTORIES列出的目录将作为tarball备份到BM_REPOSITORY_ROOT目录,然后通过SSH传输到BM_UPLOAD_SSH_DESTINATION指定的主机dev和dev。
⑤正如你在上面图片中看到的那样,备份管理器在运行的时候创建了一个名为/root/.back-manager_my.f的文件,MySQL密码通过BM_MYSQL_ADMINPASS指定。那样,mysqldump可以验证到MySQL服务器,而不必在命令行以明文格式接受密码,那样会有安全风险。
⑥通过cron运行备份管理器
⑦一旦决定哪一天是进行每周备份的最佳日子(最佳时间,你可以让cron来为你运行备份管理器。
⑧打开root的crontab文件(注意,你必须以root登录:
⑨# crontab -e
⑩假定你想要在星期天的上午:分运行备份管理器,那么就添加下面这行。
Ⅰ**/usr/sbin/backup-manager 》/dev/null》&
Ⅱ上面就是Linux使用backup-manager备份系统的方法介绍了,相对于其他的备份工具,backup-manager更加的简单易用,是系统备份的好帮手。