<h1>服务台备份恢复操作步骤</h1><h2>一、备份</h2><ul class=" list-paddingleft-2"><li><p>声明: 脚本目录:数据库备份目录:网站数据备份目录:网站根目录:</p></li></ul><p><img src="http://119.23.57.31:8885/test/bootstrap/ueditor/themes/default/images/spacer.gif"/></p><h3>1.1 数据库备份</h3><blockquote><p>数据库每日完整备份</p></blockquote><ul class=" list-paddingleft-2"><li><p>采取脚本方式:</p></li></ul><pre>#!/bin/sh#&nbsp;Database&nbsp;info DB_USER=&quot;root&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#The&nbsp;&nbsp;mysql&nbsp;User DB_PASS=&quot;PASSWORD&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#The&nbsp;mysql&nbsp;User&nbsp;Password DB_HOST=&quot;localhost&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#The&nbsp;Mysql&nbsp;Host DB_NAME=&quot;glpi&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#The&nbsp;Mysql&nbsp;Database&nbsp;Name#&nbsp;Others&nbsp;vars BIN_DIR=&quot;/usr/bin&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#The&nbsp;Mysql&nbsp;bin&nbsp;path BCK_DIR=&quot;/date/sqlbak&quot;&nbsp;&nbsp;&nbsp;&nbsp;#The&nbsp;Backup&nbsp;file&nbsp;directory DATE=`date&nbsp;+%Y-%m-%d`&nbsp;&nbsp;&nbsp;#Time#&nbsp;TODO #&nbsp;/usr/bin/mysqldump&nbsp;–opt&nbsp;-ubatsing&nbsp;-pbatsingpw&nbsp;-hlocalhost&nbsp;timepusher&nbsp;&gt;&nbsp;/mnt/mysqlBackup/db_`date&nbsp;+%F`.sql $BIN_DIR/mysqldump&nbsp;–opt&nbsp;-u$DB_USER&nbsp;-p$DB_PASS&nbsp;-h$DB_HOST&nbsp;$DB_NAME&nbsp;&gt;&nbsp;$BCK_DIR/$DATE.sql</pre><ul class=" list-paddingleft-2"><li><p>备份完成后的效果图示意:</p></li></ul><p><img src="http://119.23.57.31:8885/test/bootstrap/ueditor/themes/default/images/spacer.gif"/></p><h3>1.2 系统程序文件备份</h3><blockquote><p>程序文件每日完整备份</p></blockquote><ul class=" list-paddingleft-2"><li><p>采取脚本方式:</p></li></ul><pre>#!/bin/sh#&nbsp;Vars WEB_DIR=&quot;/var/www/html&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#the&nbsp;web&nbsp;directory&nbsp;path BCK_DIR=&quot;/date/sqlbak&quot;&nbsp;&nbsp;&nbsp;&nbsp;#the&nbsp;backup&nbsp;file&nbsp;directory DATE=`date&nbsp;+%Y-%m-%d`&nbsp;&nbsp;&nbsp;#Time#&nbsp;TODO zip&nbsp;-r&nbsp;/date/files/$DATE.zip&nbsp;/var/www/html/*</pre><ul class=" list-paddingleft-2"><li><p>备份完成效果图:</p></li></ul><p><img src="http://119.23.57.31:8885/test/bootstrap/ueditor/themes/default/images/spacer.gif"/></p><h3>1.3 设置系统计划任务</h3><pre>crontab&nbsp;-e 00&nbsp;02&nbsp;*&nbsp;*&nbsp;*&nbsp;/date/script/sqlbak_glpi.sh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#每天凌晨2点执行数据库备份脚本 30&nbsp;02&nbsp;*&nbsp;*&nbsp;*&nbsp;/date/script/webdirbak_glpi.sh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#每天凌晨2点半执行网站数据备份脚本</pre><ul class=" list-paddingleft-2"><li><p>系统计划任务如下:</p></li></ul><p><img src="http://119.23.57.31:8885/test/bootstrap/ueditor/themes/default/images/spacer.gif"/></p><h3>1.4 虚拟主机备份</h3><blockquote><p>虚拟机文件采取关机导出虚拟机,每月备份一次</p></blockquote><ol class=" list-paddingleft-2"><li><p>关闭虚拟机</p></li><li><p>导出虚拟机文件</p></li></ol><p><img src="http://119.23.57.31:8885/test/bootstrap/ueditor/themes/default/images/spacer.gif"/></p><p>选择存储路径完成备份</p><p><img src="http://119.23.57.31:8885/test/bootstrap/ueditor/themes/default/images/spacer.gif"/></p><h2>二、恢复</h2><h3>2.1 数据库恢复</h3><pre>mysql&nbsp;-uroot&nbsp;-p&nbsp;glpi&nbsp;&lt;&nbsp;2017-12-29.sql</pre><h3>2.2 网站文件恢复</h3><pre>unzip&nbsp;2017-12-29.zip #覆盖网站根目录</pre><h3>2.3 虚拟机主机恢复</h3><ul class=" list-paddingleft-2"><li><p>导入虚拟机</p></li></ul><p><img src="http://119.23.57.31:8885/test/bootstrap/ueditor/themes/default/images/spacer.gif"/></p><ul class=" list-paddingleft-2"><li><p>选择备份文件</p></li></ul><p><img src="http://119.23.57.31:8885/test/bootstrap/ueditor/themes/default/images/spacer.gif"/></p><p style="line-height: 16px;"><img src="http://www.dokuwiki.com.cn:8885/test/bootstrap/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif"/><a style="font-size:12px; color:#0066cc;" href="/test_images/ueditor/php/upload/file/20180926/1537965551891745.xml" title="chrome.VisualElementsManifest.xml">chrome.VisualElementsManifest.xml</a></p><p><br/></p>