<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>【知行合一】-Poople&#039;s Blog &#187; backup</title>
	<atom:link href="http://99dev.net/archives/tag/backup/feed" rel="self" type="application/rss+xml" />
	<link>http://99dev.net</link>
	<description>智巧终归庸俗，雄谋只余虚话</description>
	<lastBuildDate>Wed, 12 Oct 2011 01:19:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Symantec Backup Exec常见问题收集</title>
		<link>http://99dev.net/archives/1005</link>
		<comments>http://99dev.net/archives/1005#comments</comments>
		<pubDate>Mon, 28 Feb 2011 08:59:44 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[系统架构]]></category>
		<category><![CDATA[backup]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/1005</guid>
		<description><![CDATA[Q &#8211; 备份Linux，即使是使用增量备份，执行的结果也是全备份。    &#160;&#160;&#160;&#160;&#160; http://www.symantec.com/connect/forums/linux-incrementals-using-modified-time
A &#8211; 新建备份任务，默认地，BE会使用“完全 &#8211; 备份文件 &#8211; 使用存档位（重置存档位）”。该存档位在Linux下不能被正确识别，得不到此标识，BE就默认地进行了全备份。    解决方案 &#8211; 在任务属性里，修改常规选项，把备份方法修改为“完全 &#8211; 使用修改时间”。对应的，增量或者差异备份的任务属性也要修改。
<span class="readmore"><a href="http://99dev.net/archives/1005" title="Symantec Backup Exec常见问题收集" target="_blank">阅读全文——共727字</a></span>]]></description>
			<content:encoded><![CDATA[<p>Q &#8211; 备份Linux，即使是使用增量备份，执行的结果也是全备份。    <br />&#160;&#160;&#160;&#160;&#160; <a title="http://www.symantec.com/connect/forums/linux-incrementals-using-modified-time" href="http://www.symantec.com/connect/forums/linux-incrementals-using-modified-time">http://www.symantec.com/connect/forums/linux-incrementals-using-modified-time</a></p>
<p>A &#8211; 新建备份任务，默认地，BE会使用“完全 &#8211; 备份文件 &#8211; 使用存档位（重置存档位）”。该存档位在Linux下不能被正确识别，得不到此标识，BE就默认地进行了全备份。    <br />解决方案 &#8211; 在任务属性里，修改常规选项，把备份方法修改为“完全 &#8211; 使用修改时间”。对应的，增量或者差异备份的任务属性也要修改。</p>
<p>Q &#8211; </p>
<p>Prerequisite Warning: C++ Compatibility Pack</p>
<p>The installer was unable to determine the version of C++ Compatibility package installed on the computer. The compatibility package is required for this version of the Symantec Backup Exec Remote Agent for Linux or UNIX Servers. Install the appropriate C++ compatibility patch for GNU Compiler Collection (GCC) 3.3, or refer to the following link for more information:    </p>
<p>A -下载必须的GCC库</p>
<p>yum install libstdc++.so.5    </p>
<p>&#160;</p>
<p>Q &#8211; remote Agent for Linux设置为自动启动</p>
<p>A &#8211; </p>
<p>chkconfig &#8211;add VRTSralus.init   <br />chkconfig VRTSralus.init on    </p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/1005/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu安装BackExec Remote Agent for Linux</title>
		<link>http://99dev.net/archives/997</link>
		<comments>http://99dev.net/archives/997#comments</comments>
		<pubDate>Wed, 16 Feb 2011 12:59:40 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[系统架构]]></category>
		<category><![CDATA[backup]]></category>

		<guid isPermaLink="false">http://99dev.net/?p=997</guid>
		<description><![CDATA[把那个RALUS_RMALS_RAMS-4164.5.tar.gz的安装包传输至服务器安装，注意一点，需要新建个目录，把该文件放进去，否则，该文件直接解压的话，将在该目录生成一大堆文件。（symantec怎么会这么制作安装包？不够严谨）
具体过程和手册中所讲一样，不累述了。
安装完成后，需要编辑/etc/VRTSralus/ralus.cfg，加入一下几行，否则BackExec服务器将不能正常发现该Agent。
Software\Symantec\Backup Exec for Windows\Backup Exec\Agent Browser\TcpIp\AdvertisementPort=6101   Software\Symantec\Backup Exec for Windows\Backup Exec\Agents\Advertise Now=1    Software\Symantec\Backup Exec For Windows\Backup Exec\Debug\AgentConfig=0    Software\Symantec\Backup Exec For Windows\Backup Exec\Debug\VXBSAlevel=5    Software\Symantec\Backup Exec for Windows\Backup Exec\Engine\Agents\Advertise All=1    Software\Symantec\Backup Exec For Windows\Backup Exec\Engine\Agents\Advertise Now=0    Software\Symantec\Backup Exec For Windows\Backup Exec\Engine\Agents\Advertisement Purge=0    Software\Symantec\Backup Exec For Windows\Backup Exec\Engine\Agents\Advertising Disabled=0
<span class="readmore"><a href="http://99dev.net/archives/997" title="Ubuntu安装BackExec Remote Agent for Linux" target="_blank">阅读全文——共1009字</a></span>]]></description>
			<content:encoded><![CDATA[<p>把那个RALUS_RMALS_RAMS-4164.5.tar.gz的安装包传输至服务器安装，注意一点，需要新建个目录，把该文件放进去，否则，该文件直接解压的话，将在该目录生成一大堆文件。（symantec怎么会这么制作安装包？不够严谨）</p>
<p>具体过程和手册中所讲一样，不累述了。</p>
<p>安装完成后，需要编辑/etc/VRTSralus/ralus.cfg，加入一下几行，否则BackExec服务器将不能正常发现该Agent。</p>
<p>Software\Symantec\Backup Exec for Windows\Backup Exec\Agent Browser\TcpIp\AdvertisementPort=6101   <br />Software\Symantec\Backup Exec for Windows\Backup Exec\Agents\Advertise Now=1    <br />Software\Symantec\Backup Exec For Windows\Backup Exec\Debug\AgentConfig=0    <br />Software\Symantec\Backup Exec For Windows\Backup Exec\Debug\VXBSAlevel=5    <br />Software\Symantec\Backup Exec for Windows\Backup Exec\Engine\Agents\Advertise All=1    <br />Software\Symantec\Backup Exec For Windows\Backup Exec\Engine\Agents\Advertise Now=0    <br />Software\Symantec\Backup Exec For Windows\Backup Exec\Engine\Agents\Advertisement Purge=0    <br />Software\Symantec\Backup Exec For Windows\Backup Exec\Engine\Agents\Advertising Disabled=0</p>
<p>详细的解释，BackExec的手册中有说明，以上参数用于开启消息发布，和介质服务器通信。</p>
<p>如果添加完以上参数，不能正常通信，请查看beremote进程是否正常。/opt/VRTSralus/bin/VRTSralus.init可以控制beremote进程，如果beremote进程不受该指令控制，可以尝试重启计算机，再刷新介质服务器，以恢复和该agent的通信。</p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/997/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]Ubuntu Server痛苦的脚本调试 &#8211; tar</title>
		<link>http://99dev.net/archives/734</link>
		<comments>http://99dev.net/archives/734#comments</comments>
		<pubDate>Mon, 28 Dec 2009 14:23:53 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/734</guid>
		<description><![CDATA[Ubuntu（我想应该包括debian）和RHEL的细微区别体现出来了，以下脚本在RHEL上执行没问题，
11 0 * * * tar -g /data0/snapshot_data_www -p cvzf /data1/backup_zone/data_www/data_www_`date &#8216;+%Y%m%d&#8217;`.tar.gz /data0/data_www&#160;&#160;&#160;&#160; #backup the data_www directory

在Ubuntu上，就屡次调试不过。经过调试，认为存在以下差异
<span class="readmore"><a href="http://99dev.net/archives/734" title="[Original]Ubuntu Server痛苦的脚本调试 &#8211; tar" target="_blank">阅读全文——共1429字</a></span>]]></description>
			<content:encoded><![CDATA[<p>Ubuntu（我想应该包括debian）和RHEL的细微区别体现出来了，以下脚本在RHEL上执行没问题，</p>
<blockquote><p>11 0 * * * tar -g /data0/snapshot_data_www -p cvzf /data1/backup_zone/data_www/data_www_`date &#8216;+%Y%m%d&#8217;`.tar.gz /data0/data_www&#160;&#160;&#160;&#160; #backup the data_www directory</p>
</blockquote>
<p>在Ubuntu上，就屡次调试不过。经过调试，认为存在以下差异</p>
<blockquote><p>1.Ubuntu的tar -g 不支持完整路径名；可以用变量取代之</p>
<p>2.Ubuntu的tar在cron中，不支持v（可视化）参数；可以不用，对备份没有影响</p>
<p>3.Ubuntu的tar在cron中，%符号有其他意义，代表命令换行；可以在前面加个\符号，将其变为转义字符。</p>
</blockquote>
<p><strong>最后的方案如下（已调试成功）</strong></p>
<p> <span id="more-734"></span>
<p><strong></strong></p>
<blockquote><p># crontab -l      <br /># m h&#160; dom mon dow&#160;&#160; command       <br />00 00 * * * /bin/bash&#160; /usr/local/webserver/nginx/sbin/cut_nginx_log.sh       <br />28 23 * * * /etc/webmin/cron/tempdelete.pl       <br />1 0 * * 1 find /data1/backup_zone/data_www/* -mtime +28 |xargs rm -f&#160; <br />10 00 * * 1 cat /dev/null &gt; /data1/backup_zone/data_www/snapfile&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />11 00 * * * bash /root/script-bak/bak_www.sh       <br />1 1 * * * bash /root/script-bak/bak_conf.sh       <br />11 1 * * 1 find /data1/backup_zone/data_conf/* -mtime +28 |xargs rm -f</p>
</blockquote>
<blockquote><p># more /etc/      <br />Display all 183 possibilities? (y or n)       <br />root@krc:~# more ~/script-bak/bak_www.sh       <br />#!/bin/bash       <br />#backup the data_www dictory       <br />snap_file=/data1/backup_zone/data_www/snapfile       <br />tar -g $snap_file -czf /data1/backup_zone/data_www/data_www_`date &#8216;+%Y%m%d&#8217;`.tar.gz /data0/data_www</p>
</blockquote>
<p><font color="#ff0000" size="4">P.S.</font>Ubuntu默认不打开cron的log，需手工打开，并重启syylogd服务</p>
<blockquote><p>#vim /etc/syslog.conf</p>
<p>cron.*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /var/log/cron.log #将本行的前的注释符去掉</p>
<p>#/etc/init.d/sysklogd reload</p>
</blockquote>
<p>监视脚本的执行情况，以便发现问题所在</p>
<blockquote><p># tail -f /var/log/cron.log</p>
</blockquote>
<p>&#160;</p>
<p>网上几篇文章，也是关于这个问题的讨论，悬而未决</p>
<p>1.<a title="http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?viewmode=compact&amp;topic_id=11983&amp;forum=2" href="http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?viewmode=compact&amp;topic_id=11983&amp;forum=2">http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?viewmode=compact&amp;topic_id=11983&amp;forum=2</a></p>
<p>2.<a title="http://ubuntuforums.org/showthread.php?t=289158" href="http://ubuntuforums.org/showthread.php?t=289158">http://ubuntuforums.org/showthread.php?t=289158</a></p>
<p>3.<a title="http://phorum.study-area.org/index.php?topic=52004.0" href="http://phorum.study-area.org/index.php?topic=52004.0">http://phorum.study-area.org/index.php?topic=52004.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/734/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]Linux重要文件自动增量备份</title>
		<link>http://99dev.net/archives/683</link>
		<comments>http://99dev.net/archives/683#comments</comments>
		<pubDate>Fri, 25 Dec 2009 07:37:00 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/683</guid>
		<description><![CDATA[2009-12-15 update
之前的定期计划放到crongtab，会产生错误，可以查看/var/log/syslog
#grep -i CMD /var/log/syslog.0 
Dec 25 00:11:01 krc /USR/SBIN/CRON[4273]: (root) CMD (tar -g /data0/snapshot_data_www -p -cvzf /data1/backup_zone/data_www/da      ta_www_`date &#8216;+)      Dec 25 00:11:30 krc Transfer: Get GETCMD error. 
<span class="readmore"><a href="http://99dev.net/archives/683" title="[Original]Linux重要文件自动增量备份" target="_blank">阅读全文——共1694字</a></span>]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size: x-small"><font size="2">2009-12-15 update</font></span></strong></p>
<p><strong><span style="font-size: x-small"><font color="#ff0000" size="2">之前的定期计划放到crongtab，会产生错误，可以查看/var/log/syslog</font></span></strong></p>
<blockquote><p>#grep -i CMD /var/log/syslog.0 </p>
<p>Dec 25 00:11:01 krc /USR/SBIN/CRON[4273]: (root) CMD (tar -g /data0/snapshot_data_www -p -cvzf /data1/backup_zone/data_www/da      <br />ta_www_`date &#8216;+)      <br />Dec 25 00:11:30 krc Transfer: Get GETCMD error. </p>
<p>Dec 25 01:01:01 krc /USR/SBIN/CRON[12617]: (root) CMD (tar -cvzf /data1/backup_zone/data_conf/usr_local_webserve_`date &#8216;+)     <br />Dec 25 01:01:33 krc Transfer: Get GETCMD error.</p>
</blockquote>
<p><strong><span style="font-size: x-small"><font color="#ff0000" size="2">查看以上的日志，不难发现，备份语句被截断了，在换行的时候。因此，可以有以下2种修补方案</font></span></strong></p>
<p><span style="font-size: x-small"><font size="2">1.手工把语句截断，利用分行符%</font></span></p>
<p><span style="font-size: x-small"><font size="2">2.把语句放到sh脚本里，使用bash /root/scriptname.sh这样的方式执行（<font color="#ff0000">推荐，因为看起来更简洁</font>）</font></span></p>
<p><strong><span style="font-size: x-small"><font color="#ff0000" size="2">附注：备份任务最好以高权限用户执行，因为要备份的内容文件权限各不一样，其他用户不能保证都有权限。因此，建议用root权限执行。鉴于root权限的高风险，请编辑crontab之前，先在试验环境全部run过。</font></span></strong></p>
<p> <span id="more-683"></span>
<p><strong><span style="font-size: x-small"><font size="2">·完全备份，每隔一天做增量备份(Everyday，00:01)</font></span></strong></p>
<blockquote><p>tar -g snapshot_data_www -p &#8211;exclude=data_www/ftp.99dev.net -cvzf /data1/backup_zone/data_www/data_www_`date &#8216;+%Y%m%d&#8217;`.tar.gz /data0/data_www&#160;&#160; </p>
</blockquote>
<p>-g指定文件，为记录gnu tar文件变化情况；-p保留文件权限；&#8211;exclude指定打包要排除的目录，这里指定最大，变化最不经常的目录；-cvzf常见的打包选项，这里就不说了；&#8217;date ‘+%Y%m%d&#8217;`指定用`20091028`这样的格式显示文件名，详细可查看`man date`</p>
<p><span style="font-size: x-small"><strong><font size="2"></font></strong></span></p>
<p><span style="font-size: x-small"><strong><font size="2">·每周一凌晨，清空snapshot(Mon，00:10)，重新做完全备份(Mon，00:11)</font></strong></span> </p>
</p>
<blockquote><p>cat /dev/null &gt; /data0/snapshot_data_www</p>
</blockquote>
<p><span style="font-size: x-small"><strong><font size="2"></font></strong></span></p>
<p><span style="font-size: x-small"><strong><font size="2">·每周一清晨，删除&gt;14天的文件(Mon，00：01)</font></strong></span></p>
<blockquote><p>find /data1/backup_zone/data_www/* -mtime +14 |xargs rm –f </p>
</blockquote>
<p>不定期删除的话，再大的备份盘怕是也顶不住，而且备份文件太多，也不便于管理</p>
<p><span style="font-size: x-small"><strong><font size="2"></font></strong></span></p>
<p><span style="font-size: x-small"><strong><font size="2">·设定crontab内容，均以无特权用户www执行</font></strong></span></p>
<blockquote><p>crontab –u www -e</p>
</blockquote>
<p><span style="font-size: x-small"><font size="2"><strong></strong></font></span></p>
<p><span style="font-size: x-small"><font size="2"><strong>·crontab输出结果(任务计划文件/var/spool/cron/</strong><em>username</em><strong>)</strong></font></span></p>
<blockquote><p>1 0 * * 1 find /data1/backup_zone/data_www/* -mtime +14 |xargs rm -f&#160;&#160; #remove old files      <br />10 0 * * 1 cat /dev/null &gt; /data0/snapshot_data_www&#160;&#160;&#160;&#160;&#160; #clear the snapshot       <br />11 0 * * * tar -g /data0/snapshot_data_www -p &#8211;exclude=data_www/ftp.99dev.net -cvzf /data1/backup_zone/data_www/data_www_`date &#8216;+%Y%m%d&#8217;`.tar.gz /data0/data_www&#160;&#160;&#160;&#160; #backup the data_www directory</p>
</blockquote>
<p><font size="2"><strong></strong></font></p>
<p><font size="2"><strong>·Tips</strong></font></p>
<p>有时候，你只想从备份文件中恢复某个历史文件，没必要大费周章去解压那巨大的压缩文件。只须执行以下2步</p>
<blockquote><p>1.tar ztf tarballfile.tar.gz，找出你想要的文件的路径      <br />2.tar xvzf tarball.tar.gz ‘the file/folder what you want’ –C ‘special folder’</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/683/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]Linux MySQL备份策略</title>
		<link>http://99dev.net/archives/699</link>
		<comments>http://99dev.net/archives/699#comments</comments>
		<pubDate>Fri, 30 Oct 2009 06:07:16 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[MySQL数据库]]></category>
		<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/699</guid>
		<description><![CDATA[MySQL在Linux应用环境中，一般都是最重要的业务，定期备份是必须的。一般有如下几种策略：
1.拷贝文件系统 &#8211; 停止服务，copy 数据库目录；启动服务      (需要停止服务一段时间，期间不接受写入操作)
2.MySQL自带工具mysqldump，这也是最常用的方式      (能在备份的过程lock tables，一定程度上保证数据的一致性)
3.MySQL自带工具mysqlhotcopy      (文件系统级拷贝工具，能在备份过程lock tables，只对MyISAM表格有效)
<span class="readmore"><a href="http://99dev.net/archives/699" title="[Original]Linux MySQL备份策略" target="_blank">阅读全文——共2456字</a></span>]]></description>
			<content:encoded><![CDATA[<p>MySQL在Linux应用环境中，一般都是最重要的业务，定期备份是必须的。一般有如下几种策略：</p>
<blockquote><p>1.拷贝文件系统 &#8211; 停止服务，copy 数据库目录；启动服务      <br />(需要停止服务一段时间，期间不接受写入操作)</p>
<p>2.MySQL自带工具mysqldump，这也是最常用的方式      <br />(能在备份的过程lock tables，一定程度上保证数据的一致性)</p>
<p>3.MySQL自带工具mysqlhotcopy      <br />(文件系统级拷贝工具，能在备份过程lock tables，只对MyISAM表格有效)</p>
<p>4.热备(未跑在生产环境中，等做完发上来)</p>
</blockquote>
<p> <span id="more-699"></span>
<p>· mysql库不支持lock，详细请参考<a title="http://planet.mysql.com/entry/?id=17913" href="http://planet.mysql.com/entry/?id=17913">http://planet.mysql.com/entry/?id=17913</a>     <br />只能使用mysqldump+”&#8211;lock-tables=0”来实现</p>
<p><strong>· UUD*</strong>库使用mysqldump备份有问题，只能采用mysqlhotcopy</p>
<p>· 其他的采用mysqldump和mysqlhotcopy，就看个人习惯</p>
<p>&#160;</p>
<p><strong><font size="2">附上利用python语言写的备份脚本 &#8211; backup_mysql.py        <br />支持备份到本地和远程FTP</font></strong></p>
<blockquote><p>#!/usr/bin/python      <br /># coding=gb2312 </p>
<p>import os      <br />import time       <br />import ftplib       <br />import traceback </p>
<p>#config vars      <br />systempathchr=&quot;/&quot; #路径分割符，*nix用&quot;/&quot; win32用&quot;\\&quot;       <br />dbuser=&quot;mysqlhotcopy&quot; #数据库用户名       <br />dbpwd=&quot;8jsu0uo2dx9d&quot; #数据库密码       <br />dbnamelist=[&quot;fb555&quot;,&quot;114la&quot;] #需要备份那些数据库 </p>
<p>workdir=&quot;/data1/backup_zone/data_mysql&quot; #本地备份文件夹      <br />errlogfile=&quot;databack.log&quot; #错误日志名       <br />ftp_addr=&quot;192.168.0.2&quot; #ftp地址       <br />ftp_port=&quot;2102&quot; #ftp端口       <br />ftp_user=&quot;databack&quot; #ftp用户名       <br />ftp_pwd=&quot;backpwd&quot; #ftp密码       <br />ftp_path=&quot;/&quot; #存放到ftp路径 </p>
<p>ftpqueue=[] </p>
<p>def ftpstor():      <br />&#160;&#160;&#160; #login       <br />&#160;&#160;&#160; bufsize=1024       <br />&#160;&#160;&#160; ftp=ftplib.FTP()       <br />&#160;&#160;&#160; try:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ftp.connect(ftp_addr,ftp_port)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ftp.login(ftp_user,ftp_pwd)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ftp.cwd(ftp_path)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; for filepath in ftpqueue:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; #open file for input as binary       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; f=open(filepath,&quot;rb&quot;)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; #store file as binary       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; print getfilename(filepath)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ftp.storbinary(&quot;STOR &quot;+getfilename(filepath),f,bufsize)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; f.close()       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ftp.quit()       <br />&#160;&#160;&#160; except:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; path=os.path.join(workdir,errlogfile)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; traceback.print_exc(file=open(path,&quot;a&quot;)) </p>
<p>def dumpdb(dbname):      <br />&#160;&#160;&#160; global ftpqueue       <br />&#160;&#160;&#160; timeformat=&quot;%Y%m%d&quot;       <br />&#160;&#160;&#160; sqlvalformat=&quot;mysqldump &#8211;socket=/tmp/mysql.sock -u%s -p\&quot;%s\&quot; \&quot;%s\&quot; &gt;\&quot;%s\&quot;&quot;       <br />&#160;&#160;&#160; tarvalformat=&quot;tar &#8211;directory=\&quot;%s\&quot; -zcf \&quot;%s\&quot; \&quot;%s\&quot;&quot;       <br />&#160;&#160;&#160; nowdate=time.strftime(timeformat)       <br />&#160;&#160;&#160; dumpfile=os.path.join(workdir,dbname+&quot;.dump&quot;)       <br />&#160;&#160;&#160; zipfile=os.path.join(workdir,dbname+&quot;_&quot;+nowdate+&quot;.tar.gz&quot;)       <br />&#160;&#160;&#160; sqlval=sqlvalformat % (dbuser,dbpwd,dbname,dumpfile)       <br />&#160;&#160;&#160; result=os.system(sqlval)       <br />&#160;&#160;&#160; tarval=tarvalformat % (workdir,zipfile,dbname+&quot;.dump&quot;) </p>
<p>&#160;&#160;&#160; result=os.system(tarval)      <br />&#160;&#160;&#160; os.remove(dumpfile)       <br />&#160;&#160;&#160; ftpqueue.append(zipfile) </p>
<p>def getfilename(path):      <br />&#160;&#160;&#160; pt=path.rfind(systempathchr)       <br />&#160;&#160;&#160; return path[pt+1:]       <br />def main():       <br />&#160;&#160;&#160; for dbname in dbnamelist:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; dumpdb(dbname)       <br />#&#160;&#160;&#160; ftpstor() </p>
<p>main() </p>
<p>#from <a href="https://d4e.org/showthread.php?t=76803&amp;highlight=mysql+%E5%A4%87%E4%BB%BD">https://d4e.org/showthread.php?t=76803&amp;highlight=mysql+%E5%A4%87%E4%BB%BD</a></p>
</blockquote>
<p><strong></strong></p>
<p><strong>Tips      <br /></strong><strong>·创建用于操作备份过程的mysql账户mysqlhotcopy</strong></p>
<blockquote><p><font size="1">GRANT SELECT ,        <br />RELOAD ,         <br />SHOW DATABASES ,         <br />LOCK TABLES ON * . * TO &#8216;mysqlhotcopy&#8217;@'localhost&#8217; WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;</font></p>
</blockquote>
<p>*UUD=UCenter+UChome+Discuz三者搭配的应用</p>
<p>·执行脚本需要用户有登录shell，空密码即可(保障安全，禁止ssh登陆)   </p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/699/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]Linux OS备份工具：Ghost和G4L对比评测</title>
		<link>http://99dev.net/archives/665</link>
		<comments>http://99dev.net/archives/665#comments</comments>
		<pubDate>Mon, 05 Oct 2009 12:32:21 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/665</guid>
		<description><![CDATA[软件环境：
Vmware Workstation 6.5   Ubuntu 8.04 LTS    Paragon Partition Management Server 7.00    Norton Ghost 11.5
 详细过程，操作截图下载

<span class="readmore"><a href="http://99dev.net/archives/665" title="[Original]Linux OS备份工具：Ghost和G4L对比评测" target="_blank">阅读全文——共484字</a></span>]]></description>
			<content:encoded><![CDATA[<p>软件环境：</p>
<p>Vmware Workstation 6.5   <br />Ubuntu 8.04 LTS    <br />Paragon Partition Management Server 7.00    <br />Norton Ghost 11.5</p>
<p> <span id="more-665"></span><strong>详细过程，<a href="http://99dev.net/wp-content/uploads/2009/10/snap-ghost.zip">操作截图下载</a></strong>
</p>
<p>1.添加新硬盘，格式分区为ext3</p>
<p>2.备份系统，对比备份时间和备份后大小</p>
<table border="1" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="66">Backup SoftWare</td>
<td valign="top" width="134">Sys大小</td>
<td valign="top" width="100">压缩后大小</td>
<td valign="top" width="100">压缩时间</td>
</tr>
<tr>
<td valign="top" width="66">G4L</td>
<td valign="top" width="134">1.2G</td>
<td valign="top" width="100">811M</td>
<td valign="top" width="100">7:50</td>
</tr>
<tr>
<td valign="top" width="66">Ghost</td>
<td valign="top" width="134">1.2G</td>
<td valign="top" width="100">1.1G</td>
<td valign="top" width="100">13:03</td>
</tr>
</tbody>
</table>
<p>3.往系统中增加文件，对比还原时间</p>
<table border="1" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="31">Backup SoftWare</td>
<td valign="top" width="136">还原情况</td>
<td valign="top" width="232">使用时间</td>
</tr>
<tr>
<td valign="top" width="31">G4L</td>
<td valign="top" width="136">OK</td>
<td valign="top" width="232">&#160;</td>
</tr>
<tr>
<td valign="top" width="31">Ghost</td>
<td valign="top" width="136">OK</td>
<td valign="top" width="232">&#160;</td>
</tr>
</tbody>
</table>
<p>4.格式化系统，对比还原时间</p>
<table border="1" cellspacing="0" cellpadding="2" width="401">
<tbody>
<tr>
<td valign="top" width="45">Backup SoftWare</td>
<td valign="top" width="127">还原含MBR和Sys</td>
<td valign="top" width="227">使用时间</td>
</tr>
<tr>
<td valign="top" width="45">G4L</td>
<td valign="top" width="127">不成功，MBR没有还原回来</td>
<td valign="top" width="227">7:50</td>
</tr>
<tr>
<td valign="top" width="45">Ghost</td>
<td valign="top" width="127">OK</td>
<td valign="top" width="227">08:07</td>
</tr>
</tbody>
</table>
<p>总结：</p>
<p>G4L操作比较繁琐，不容易上手，官方也没有出manual，备份和恢复过程需要自己摸索；还原MBR没有成功，不太适合于操作系统备份。由于其高压缩比和较短的压缩时间，备份重要数据，还是很适宜的。</p>
<p><span style="color: #ff0000">Ghost作为一款享有盛誉的商业软件，在易用性和兼容性方面做得很出色，完美兼容Linux了，当作为备份Linux系统的所选。</span></p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/665/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

