我使用RARLABS RAR.exe来存档/备份我的服务器数据。我很熟悉使用RAR创建存档和从文件夹中添加文件,但是直接将数据流到存档中会怎么样呢?
例如,在备份我的MySQL数据库时,我使用mysqldump命令将管道命令包含到文本文件中。最好跳过文件步骤,使用如下语法直接进入存档文件:
mysqldump -uUserName -pPassword --all-databases > rar.exe newarchivename.rar有没有人知道我所描述的,或者类似的事情,是否可能发生?
发布于 2010-02-24 17:45:24
我联系了RARLabs的支持部门,并收到了回复。事实证明,RAR.EXE可以处理类似于gzip工作方式的流输入。只需指定-si选项:
-si[name]
Read data from stdin (standard input), when creating
an archive. Optional 'name' parameter allows to specify
a file name of compressed stdin data in the created
archive. If this parameter is missing, the name will be
set to 'stdin'. This switch cannot be used with -v.为什么我要使用RAR而不是GZIP?好吧,GZIP没有的一点是自动在文件名上包含日期标记的能力。
因此,有了这个信息,这里就是我将如何备份MySQL数据库信息的一个例子:
mysqldump --all-databases | rar a -siWordPressDB.sql -ag_MMMDDYYYY-HHMM WordPressDB.sql.rar它创建一个与以下名称类似的归档文件:
WordPressDB.sql_Feb242010-0938.rar并包含一个文件:
WordPressDB.sql很酷..。
发布于 2010-03-21 14:17:23
谢谢,这正是我要找的,这更有用。
不错,我不知道它能做到这一点(我的rar版本中没有一个支持-si选项)。(升级时间)-詹姆斯2月24日19:07
此功能至少可以从v3.71开始使用。
由于某些原因,此函数不在手册中。
您可以在rar.txt文件中找到这些信息和更多信息。
(*nix)通常在/usr/share/doc/rar (rar.txt或rar.txt.gz)中
https://serverfault.com/questions/115584
复制相似问题