2009年8月31日星期一

Mac下的bloger editor test

不得不承认自己的愚钝,这么好的思想不会用,在windows下面使用的是windows live writer决的不错,干活很高效,想mac下面也应该有把,果不其然,MarsEdit, ecto, 等等,试用一下MarsEdit先。

成功安裝了Pydev,運行了”Hello World”

在我的Mac上面安裝了 Eclipse插件Pydev, 運行了”Hello World”.

以後python的開發準備用這個東東了.

參考:http://ez2learn.com/index.php/python-tutorials/eclipse-pydev-tutorials/181-eclipse--pydev

What is IAF(Identity Assurance Framework)?

.Framework supporting mutual acceptance, validation and lifecycle maintenance across identity federations.

# 框架支持相互認可,校驗和跨認證聯邦的生命週期維護.

.EAP Trust Framework and US  e-Authentication Federation Credential Accessment Framework as baseline.

#以"EAP Trust Framework "和"US  e-Authentication "聯邦信用訪問框架為底線

.Harmonized, best-of-breed industry identity assurance standard

. Identity credential policy #身份信用策略

. Business procedure and rule set #業務行程和規則集

. Baseline commerical terms  #基本商業用語

. Guideline to foster inter-federation on a global scale

. it consists of 4 parts: #4個組成部份

. Assurance Levels # 保險級別

. Service Assessment Criteria # 服務評估規則

. Accreditation and Certification Model #鑒定認證模塊

. Business Rules #業務規則

IAF Assurance Levels

Four primary levels of Assurance:

. level 1 – little or no confidence in asserted identity’s validity #在身份校驗沒有機密

. level2 – Some confidence 一些機密

. level3 – High level of confidence  高級的機密

. level4 – Very high level of confidence 特高級機密

.Use of Assurance Level is determined by level of  authentication necessary to mitigate risk in the transaction, as determined by the Relying Party

AL1 – PIN and Password

AL2 – Single Factor; Prove control of token through authentication protocol

AL3 – Multi-factor auth; Cryptpgraphic protocol; “soft”, “hard”, or “OTP” tokens

AL4 – Multi-factor auth w/hard token only; crypto protocol w/keys bound to auth process

Zen of python--應該是必讀的吧

The Zen of Python
    Beautiful is better than ugly. 漂亮別醜陋強
Explicit is better than implicit. 顯性比隱性的強
Simple is better than complex. 簡單比複雜強
Complex is better than complicated. 組合複雜比結構複雜強
Flat is better than nested. 直接比嵌套強
Sparse is better than dense. 稀疏比稠密強
Readability counts. 可讀性
Special cases aren't special enough to break the rules. 別壞了規矩
Although practicality beats purity. 與簡潔合拍
Errors should never pass silently. 有問題不能不出聲
Unless explicitly silenced. 
In the face of ambiguity, refuse the temptation to guess. 別叫人家猜
There should be one-- and preferably only one --obvious way to do it. 只有一個合適的方法
Although that way may not be obvious at first unless you're Dutch.
Now is better than never. 馬上行動
Although never is often better than *right* now. 
If the implementation is hard to explain, it's a bad idea. 如果實現的沒辦法解釋,它一定是個壞想法
If the implementation is easy to explain, it may be a good idea. 如果實現解釋起來很簡單,它也許是一個好想法
Namespaces are one honking great idea -- let's do more of those! 

ref: http://www.python.org/dev/peps/pep-0020/

準備用Python寫點小東西,遇到的第一個問題:python 調用系統命令

python
Python 2.6.2 (r262:71600, Aug 19 2009, 12:13:04)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> os.system('ls')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'os' is not defined
###貌似沒有找到os這個東東(module)

>>> import os
>>> os.system('ls')
Desktop             rubyStudy
>>>

出來了.

2009年8月28日星期五

安全防護不是一種東西,而是一種系統的特性

Security is not "stuff." Security is a property of a system.

安全防護不是一種東西,而是一種系統的特性

--Web Security Testing Cookbook

數據庫存在是爲了方便組織資料(信息)的

 

這句話叫我茅塞頓開:

文件file是OS提供的一部分,很重要的一个东西,文件定义后,程序可以看到这个文件,并進行操作,数据库 是爲了方便组织资料的(信息,資訊)

所以數據庫是爲了一個組織的信息提供井然有序的服務而存在的,它的一切活動是爲了"方便"二字!

記錄一下!

一個不錯的視頻—Understanding IPSEC

一直不是太明白IPSec的工作模式,youTube上的一個視頻講解的很清楚

IPSec provides an automated solution for three areas:

. authentication

. integrity

. confidentiality

IPSec is application independent  這句話最重要

IPsec Tunnel Mode packet---Using IPsec with virtual priviate networking
(IP Header (IPSec Header (IP Header( TCP Header(Data)))))

參考 http://www.youtube.com/watch?v=DH1zI8QYi4A

2009年8月27日星期四

耶魯的開發課程,心嚮往之

從twitter上推友那裡找到的

http://oyc.yale.edu/courselist 

課程可以下載,當然我正在下載,可惜我的英文還不行,而且心思目前還不能放在這個上面,這麼好的資源記錄一下.

Python 安裝三板斧

見笑,最近學習python,用到numpy這個包,因為裏面有array, python building-in沒有這個容器,所以要從外面安裝,Mac OS的直接從

http://sourceforge.net/projects/numpy/files/NumPy/ 下載最新的安裝即可.

但是開發環境是CentOS,咋整呢?只能用源代碼編譯的方式,摸索了半天,裝上了,記錄一下,估計Python的第三方包都是這樣安裝的吧:

 

下載最新的tar包

wget –c http://sourceforge.net/projects/numpy/files/NumPy/1.3.0/numpy-1.3.0.tar.gz/download

tar xvfz numpy-1.3.0.tar.gz

[root@CRRACTEST2 software]# cd numpy-1.3.0
[root@CRRACTEST2 numpy-1.3.0]# ls
build           doc          MANIFEST.in  README.txt   setupscons.py
COMPATIBILITY   INSTALL.txt  numpy        setupegg.py  site.cfg.example
DEV_README.txt  LICENSE.txt  PKG-INFO     setup.py     THANKS.txt
[root@CRRACTEST2 numpy-1.3.0]#

安裝:

python ./setup.py build ##第一步是build

python ./setup.py install  ##第二步是install

測試:

[root@CRRACTEST2 ~]# python
Python 2.6.2 (r262:71600, Aug 19 2009, 12:13:04)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import *
>>> vec = array([1,2])
>>> vec +2
array([3, 4])
>>> vec *3
array([3, 6])
>>>

可用了,繼續研究!

2009年8月24日星期一

Shell批量修改文件内容

N多年前,因為改CVS server的ip, 但是文件中所有的ip地址都要改,當時google了半天沒有結果,這個事情一直記得,今天發現了一個腳本很簡單,

Shell批量修改文件内容
比如说,我想把网页文件里的foo都替换成bar,主要是利用sed的-i参数:
find /path -type f | grep -i -E '(htm|html)$' | xargs sed -i 's/foo/bar/g'

參考:http://hi.baidu.com/thinkinginlamp/blog/item/2297a7efb470541ffdfa3ca2.html

記錄一下,以備后查

2009年8月20日星期四

All security controls should be built on the concept of preventive security .

All security controls should be built on the concept of preventive security .

所有的安全相關的控制都是建立在"預防,防止preventive”基礎上的

To take this concept further, what you can't prevent, you should be able to detect, and if you  detect something, it means you weren't able to prevent it, and therefore you should take corrective  action to make sure it is indeed prevented the next time around.

這個概念上延展一下,如果你不能預防該, 你應該能夠探測(detect)得到,如果你可以探測到什麽東西,就意味著你不能預防它,並且你應該對它有矯正(corrective)的行動,確保不會出現下一次

therefore, all three types work together: preventive ,detective and corrective.

因此,這三種類型的控制應該一起工作: 預防,探測和矯正.

Oracle 11g RAC“Oracle clsomon failed with fatal status 13.”

生產環境的數據庫,經常不定期的重新啟動,OS系統報錯:

/var/log/message

Aug 10 14:14:28 oracle01 logger: Oracle clsomon failed with fatal status 13.
Aug 10 14:14:29 oracle01 logger: Oracle CRS failure. Rebooting for cluster integrity.
Aug 10 14:16:21 oracle01 syslogd 1.4.1: restart.

根據oracle文檔說明,懷疑是一個bug

http://download.oracle.com/docs/cd/B28359_01/relnotes.111/b32001/toc.htm

因為是生產環境,一直在等待時機,終於在上周更換了

1,将节点的crs stop
crsctl stop crs
2 更新glibc相关的包
[root@oracle02 glibc2.5-24]# rpm -qa |grep glibc
glibc-devel-2.5-18
glibc-devel-2.5-18
glibc-2.5-18
glibc-common-2.5-18
glibc-headers-2.5-18
compat-glibc-headers-2.3.4-2.26
compat-glibc-2.3.4-2.26
glibc-2.5-18
compat-glibc-2.3.4-2.26
[root@oracle02 glibc2.5-24]#
======
[root@oracle02 glibc2.5-24]# rpm -Uvh --force glibc*.rpm
warning: glibc-2.5-24.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:glibc-common ########################################### [ 14%]
2:glibc ########################################### [ 29%]
3:glibc warning: /etc/ld.so.conf created as /etc/ld.so.conf.rpmnew
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
########################################### [ 43%]
4:glibc-headers ########################################### [ 57%]
5:glibc-devel ########################################### [ 71%]
6:glibc-devel ########################################### [ 86%]
7:glibc-utils ########################################### [100%]
[root@oracle02 glibc2.5-24]#
[root@oracle02 glibc2.5-24]# rpm -qa |grep glibc
glibc-common-2.5-24
glibc-devel-2.5-24
compat-glibc-headers-2.3.4-2.26
glibc-2.5-24
glibc-utils-2.5-24
compat-glibc-2.3.4-2.26
glibc-headers-2.5-24
glibc-devel-2.5-24
compat-glibc-2.3.4-2.26
3, crsctl start crs
等运行稳定了之后,为了保险起见,reboot一下机器,等运行稳定了以后再更新另一个节点,步骤一样

記錄一下,itpub上的記錄:

http://www.itpub.net/viewthread.php?tid=1158148&pid=14116280&page=1&extra=#pid14116280

2009年8月18日星期二

ZRM for MySQL for remote backup with socket- and SSH copy plug-ins

Here is the roadmap of what we cover in the rest of this document:
這裡列出相關的操作步驟:
backup server 172.16.1.166
production 數據庫(socket model backup) 172.16.1.162
production數據庫(ssh copy model) 172.16.1.165

. Setup MySQL-ZRM on the backup server “172.16.1.166” and create a backup set called DailyBackupDB1 to back up two databases on “172.16.1.162”
這裡166是Mysql backup center server, 162模擬 production 數據庫(socket model backup) 165 模擬 production數據庫(ssh copy model)
2. Prepare 162 to be backed up using the socket copy plug-in
對162使用socket copy plug-in模式
3. Configure firewall for backups between “166” and “db1.162”
166和162配置防火牆
4. Setup ZRM on the backup server and create a backup set called DailyBackupDB2 to backup MoviesMyISAM database on “165”
創建在備份服務器,并創建備份集叫做DailyBackupDB2來備份 db2.165
5. Prepare db2.zmanda.com for back up using the SSH copy plug-in
準備db2.162使用ssh copy 模式
6. Configure firewall for backups between “166” and “db2.165”
配置166,db2.166之間的防火墻
7. Perform the backup of both backup sets DailyBackupDB1 and DailyBackupDB2 from the command line
命令行執行 執行backup Daily BackupDB1 , Daily Backup DB2
8. Verify backup and check performance statistics
校驗和檢查性能
9. Set up Automated backups
自動化備份
10. Recover MySQL data
恢復實驗

1 配置 backup 服務器
a. backup server Mysql 安裝

[root@croracle02 software]# rpm -Uvh MySQL-server-community-5.1.36-0.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server-community ########################################### [100%]
090813 6:07:22 [Warning] Forcing shutdown of 2 plugins
090813 6:07:22 [Warning] Forcing shutdown of 2 plugins

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h croracle02.localdomain password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

Starting MySQL..........[ OK ]
Giving mysqld 2 seconds to start
[root@croracle02 software]#
[root@croracle02 software]# rpm -Uvh MySQL-client-community-5.1.36-0.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [100%]
[root@croracle02 software]#

[root@croracle02 software]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.36-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

開發包安裝

[root@croracle02 software]# rpm -Uvh MySQL-devel-community-5.1.36-0.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-devel-community ########################################### [100%]
[root@croracle02 software]#

安裝所需要的 Perl 包

Install DBI Module

[root@croracle02 software]# rpm -qa |grep DBI
[root@croracle02 software]#
[root@croracle02 software]# tar xvfz DBI-1.609.tar.gz
DBI-1.609/
DBI-1.609/Changes
DBI-1.609/dbd_xsh.h
DBI-1.609/DBI.pm
DBI-1.609/DBI.xs
DBI-1.609/dbi_sql.h
DBI-1.609/dbilogstrip.PL
DBI-1.609/dbipport.h
DBI-1.609/dbiprof.PL
DBI-1.609/dbiproxy.PL
DBI-1.609/dbivport.h
DBI-1.609/DBIXS.h
DBI-1.609/dbixs_rev.h
DBI-1.609/dbixs_rev.pl
DBI-1.609/Driver.xst
DBI-1.609/Driver_xst.h
DBI-1.609/ex/
DBI-1.609/ex/perl_dbi_nulls_test.pl
DBI-1.609/ex/profile.pl
DBI-1.609/lib/
DBI-1.609/lib/Bundle/
DBI-1.609/lib/Bundle/DBI.pm
DBI-1.609/lib/DBD/
DBI-1.609/lib/DBD/DBM.pm
DBI-1.609/lib/DBD/ExampleP.pm
DBI-1.609/lib/DBD/File.pm
DBI-1.609/lib/DBD/Gofer/
DBI-1.609/lib/DBD/Gofer/Policy/
DBI-1.609/lib/DBD/Gofer/Policy/Base.pm
DBI-1.609/lib/DBD/Gofer/Policy/classic.pm
DBI-1.609/lib/DBD/Gofer/Policy/pedantic.pm
DBI-1.609/lib/DBD/Gofer/Policy/rush.pm
DBI-1.609/lib/DBD/Gofer/Transport/
DBI-1.609/lib/DBD/Gofer/Transport/Base.pm
DBI-1.609/lib/DBD/Gofer/Transport/null.pm
DBI-1.609/lib/DBD/Gofer/Transport/pipeone.pm
DBI-1.609/lib/DBD/Gofer/Transport/stream.pm
DBI-1.609/lib/DBD/Gofer.pm
DBI-1.609/lib/DBD/NullP.pm
DBI-1.609/lib/DBD/Proxy.pm
DBI-1.609/lib/DBD/Sponge.pm
DBI-1.609/lib/DBI/
DBI-1.609/lib/DBI/Const/
DBI-1.609/lib/DBI/Const/GetInfo/
DBI-1.609/lib/DBI/Const/GetInfo/ANSI.pm
DBI-1.609/lib/DBI/Const/GetInfo/ODBC.pm
DBI-1.609/lib/DBI/Const/GetInfoReturn.pm
DBI-1.609/lib/DBI/Const/GetInfoType.pm
DBI-1.609/lib/DBI/DBD/
DBI-1.609/lib/DBI/DBD/Metadata.pm
DBI-1.609/lib/DBI/DBD.pm
DBI-1.609/lib/DBI/FAQ.pm
DBI-1.609/lib/DBI/Gofer/
DBI-1.609/lib/DBI/Gofer/Execute.pm
DBI-1.609/lib/DBI/Gofer/Request.pm
DBI-1.609/lib/DBI/Gofer/Response.pm
DBI-1.609/lib/DBI/Gofer/Serializer/
DBI-1.609/lib/DBI/Gofer/Serializer/Base.pm
DBI-1.609/lib/DBI/Gofer/Serializer/DataDumper.pm
DBI-1.609/lib/DBI/Gofer/Serializer/Storable.pm
DBI-1.609/lib/DBI/Gofer/Transport/
DBI-1.609/lib/DBI/Gofer/Transport/Base.pm
DBI-1.609/lib/DBI/Gofer/Transport/pipeone.pm
DBI-1.609/lib/DBI/Gofer/Transport/stream.pm
DBI-1.609/lib/DBI/Profile.pm
DBI-1.609/lib/DBI/ProfileData.pm
DBI-1.609/lib/DBI/ProfileDumper/
DBI-1.609/lib/DBI/ProfileDumper/Apache.pm
DBI-1.609/lib/DBI/ProfileDumper.pm
DBI-1.609/lib/DBI/ProfileSubs.pm
DBI-1.609/lib/DBI/ProxyServer.pm
DBI-1.609/lib/DBI/PurePerl.pm
DBI-1.609/lib/DBI/SQL/
DBI-1.609/lib/DBI/SQL/Nano.pm
DBI-1.609/lib/DBI/Util/
DBI-1.609/lib/DBI/Util/_accessor.pm
DBI-1.609/lib/DBI/Util/CacheMemory.pm
DBI-1.609/lib/DBI/W32ODBC.pm
DBI-1.609/lib/Win32/
DBI-1.609/lib/Win32/DBIODBC.pm
DBI-1.609/Makefile.PL
DBI-1.609/MANIFEST
DBI-1.609/META.yml
DBI-1.609/Perl.xs
DBI-1.609/README
DBI-1.609/Roadmap.pod
DBI-1.609/t/
DBI-1.609/t/01basics.t
DBI-1.609/t/02dbidrv.t
DBI-1.609/t/03handle.t
DBI-1.609/t/04mods.t
DBI-1.609/t/05concathash.t
DBI-1.609/t/06attrs.t
DBI-1.609/t/07kids.t
DBI-1.609/t/08keeperr.t
DBI-1.609/t/09trace.t
DBI-1.609/t/10examp.t
DBI-1.609/t/11fetch.t
DBI-1.609/t/12quote.t
DBI-1.609/t/13taint.t
DBI-1.609/t/14utf8.t
DBI-1.609/t/15array.t
DBI-1.609/t/19fhtrace.t
DBI-1.609/t/20meta.t
DBI-1.609/t/30subclass.t
DBI-1.609/t/35thrclone.t
DBI-1.609/t/40profile.t
DBI-1.609/t/41prof_dump.t
DBI-1.609/t/42prof_data.t
DBI-1.609/t/43prof_env.t
DBI-1.609/t/50dbm.t
DBI-1.609/t/60preparse.t
DBI-1.609/t/65transact.t
DBI-1.609/t/70callbacks.t
DBI-1.609/t/72childhandles.t
DBI-1.609/t/80proxy.t
DBI-1.609/t/85gofer.t
DBI-1.609/t/86gofer_fail.t
DBI-1.609/t/87gofer_cache.t
DBI-1.609/t/pod-coverage.t
DBI-1.609/t/pod.t
DBI-1.609/TASKS.pod
DBI-1.609/test.pl
DBI-1.609/TODO_2005.txt
DBI-1.609/TODO_gofer.txt
DBI-1.609/typemap
[root@croracle02 software]# cd DBI-1.609
[root@croracle02 DBI-1.609]# perl Makefile.PL

*** Your LANG environment variable is set to 'en_US.UTF-8'
*** This may cause problems for some perl installations.
*** If you get test failures, please try again with LANG unset.
*** If that then works, please email dbi-dev@perl.org with details
*** including the output of 'perl -V'
*** You are using a perl configured with threading enabled.
*** You should be aware that using multiple threads is
*** not recommended for production environments.

Your perl was compiled with gcc (version 4.1.1 20070105 (Red Hat 4.1.1-52)), okay.
Creating test wrappers for DBI::PurePerl:
t/zvp_01basics.t
t/zvp_02dbidrv.t
t/zvp_03handle.t
t/zvp_04mods.t
t/zvp_05concathash.t
t/zvp_06attrs.t
t/zvp_07kids.t
t/zvp_08keeperr.t
t/zvp_09trace.t
t/zvp_10examp.t
t/zvp_11fetch.t
t/zvp_12quote.t
t/zvp_13taint.t
t/zvp_14utf8.t
t/zvp_15array.t
t/zvp_19fhtrace.t
t/zvp_20meta.t
t/zvp_30subclass.t
t/zvp_35thrclone.t (use threads)
t/zvp_40profile.t
t/zvp_41prof_dump.t
t/zvp_42prof_data.t
t/zvp_43prof_env.t
t/zvp_50dbm.t
t/zvp_60preparse.t
t/zvp_65transact.t
t/zvp_70callbacks.t
t/zvp_72childhandles.t
t/zvp_80proxy.t
t/zvp_85gofer.t
t/zvp_86gofer_fail.t
t/zvp_87gofer_cache.t
Creating test wrappers for DBD::Gofer:
t/zvg_01basics.t
t/zvg_02dbidrv.t
t/zvg_03handle.t
t/zvg_04mods.t
t/zvg_05concathash.t
t/zvg_06attrs.t
t/zvg_07kids.t
t/zvg_08keeperr.t
t/zvg_09trace.t
t/zvg_10examp.t
t/zvg_11fetch.t
t/zvg_12quote.t
t/zvg_13taint.t
t/zvg_14utf8.t
t/zvg_15array.t
t/zvg_19fhtrace.t
t/zvg_20meta.t
t/zvg_30subclass.t
t/zvg_35thrclone.t (use threads)
t/zvg_40profile.t
t/zvg_41prof_dump.t
t/zvg_42prof_data.t
t/zvg_43prof_env.t
t/zvg_50dbm.t
t/zvg_60preparse.t
t/zvg_65transact.t
t/zvg_70callbacks.t
t/zvg_72childhandles.t
t/zvg_80proxy.t
t/zvg_85gofer.t
t/zvg_86gofer_fail.t
t/zvg_87gofer_cache.t
Creating test wrappers for PurePerl & Gofer:
t/zvxgp_01basics.t
t/zvxgp_02dbidrv.t
t/zvxgp_03handle.t
t/zvxgp_04mods.t
t/zvxgp_05concathash.t
t/zvxgp_06attrs.t
t/zvxgp_07kids.t
t/zvxgp_08keeperr.t
t/zvxgp_09trace.t
t/zvxgp_10examp.t
t/zvxgp_11fetch.t
t/zvxgp_12quote.t
t/zvxgp_13taint.t
t/zvxgp_14utf8.t
t/zvxgp_15array.t
t/zvxgp_19fhtrace.t
t/zvxgp_20meta.t
t/zvxgp_30subclass.t
t/zvxgp_35thrclone.t (use threads)
t/zvxgp_40profile.t
t/zvxgp_41prof_dump.t
t/zvxgp_42prof_data.t
t/zvxgp_43prof_env.t
t/zvxgp_50dbm.t
t/zvxgp_60preparse.t
t/zvxgp_65transact.t
t/zvxgp_70callbacks.t
t/zvxgp_72childhandles.t
t/zvxgp_80proxy.t
t/zvxgp_85gofer.t
t/zvxgp_86gofer_fail.t
t/zvxgp_87gofer_cache.t
Checking if your kit is complete...
Looks good

I see you're using perl 5.008008 on x86_64-linux-thread-multi, okay.
Remember to actually *read* the README file!
Use 'make' to build the software (dmake or nmake on Windows).
Then 'make test' to execute self tests.
Then 'make install' to install the DBI and then delete this working
directory before unpacking and building any DBD::* drivers.

Writing Makefile for DBI
[root@croracle02 DBI-1.609]# make
/usr/bin/perl "-MExtUtils::Command" -e mkpath blib/lib/DBI
rm -f blib/lib/DBI/Changes.pm
cp Changes blib/lib/DBI/Changes.pm
/usr/bin/perl "-MExtUtils::Command" -e mkpath blib/lib/DBI
rm -f blib/lib/DBI/Roadmap.pm
cp Roadmap.pod blib/lib/DBI/Roadmap.pm
cp Driver_xst.h blib/arch/auto/DBI/Driver_xst.h
cp lib/DBI/Gofer/Response.pm blib/lib/DBI/Gofer/Response.pm
cp lib/DBD/Proxy.pm blib/lib/DBD/Proxy.pm
cp lib/DBI/Util/_accessor.pm blib/lib/DBI/Util/_accessor.pm
cp lib/DBI/Gofer/Transport/Base.pm blib/lib/DBI/Gofer/Transport/Base.pm
cp lib/DBD/DBM.pm blib/lib/DBD/DBM.pm
cp DBIXS.h blib/arch/auto/DBI/DBIXS.h
cp dbixs_rev.pl blib/lib/dbixs_rev.pl
cp Roadmap.pod blib/lib/Roadmap.pod
cp lib/DBI/Const/GetInfoType.pm blib/lib/DBI/Const/GetInfoType.pm
cp lib/DBI/Gofer/Serializer/DataDumper.pm blib/lib/DBI/Gofer/Serializer/DataDumper.pm
cp lib/DBI/DBD/Metadata.pm blib/lib/DBI/DBD/Metadata.pm
cp lib/DBI/Const/GetInfo/ODBC.pm blib/lib/DBI/Const/GetInfo/ODBC.pm
cp lib/DBD/Gofer/Transport/pipeone.pm blib/lib/DBD/Gofer/Transport/pipeone.pm
cp lib/DBI/ProfileDumper/Apache.pm blib/lib/DBI/ProfileDumper/Apache.pm
cp Driver.xst blib/arch/auto/DBI/Driver.xst
cp lib/DBD/File.pm blib/lib/DBD/File.pm
cp lib/DBI/Util/CacheMemory.pm blib/lib/DBI/Util/CacheMemory.pm
cp lib/DBI/ProfileSubs.pm blib/lib/DBI/ProfileSubs.pm
cp lib/DBD/NullP.pm blib/lib/DBD/NullP.pm
cp dbi_sql.h blib/arch/auto/DBI/dbi_sql.h
cp lib/DBD/Gofer.pm blib/lib/DBD/Gofer.pm
cp dbd_xsh.h blib/arch/auto/DBI/dbd_xsh.h
cp dbivport.h blib/arch/auto/DBI/dbivport.h
cp dbixs_rev.h blib/arch/auto/DBI/dbixs_rev.h
cp lib/DBD/Gofer/Transport/Base.pm blib/lib/DBD/Gofer/Transport/Base.pm
cp lib/DBI/FAQ.pm blib/lib/DBI/FAQ.pm
cp lib/DBD/Gofer/Policy/rush.pm blib/lib/DBD/Gofer/Policy/rush.pm
cp lib/DBI/SQL/Nano.pm blib/lib/DBI/SQL/Nano.pm
cp lib/DBI/Const/GetInfo/ANSI.pm blib/lib/DBI/Const/GetInfo/ANSI.pm
cp lib/DBI/Gofer/Request.pm blib/lib/DBI/Gofer/Request.pm
cp lib/DBD/Gofer/Transport/stream.pm blib/lib/DBD/Gofer/Transport/stream.pm
cp lib/DBD/Gofer/Policy/classic.pm blib/lib/DBD/Gofer/Policy/classic.pm
cp lib/DBI/Gofer/Transport/stream.pm blib/lib/DBI/Gofer/Transport/stream.pm
cp lib/DBI/Gofer/Serializer/Storable.pm blib/lib/DBI/Gofer/Serializer/Storable.pm
cp lib/DBI/Const/GetInfoReturn.pm blib/lib/DBI/Const/GetInfoReturn.pm
cp DBI.pm blib/lib/DBI.pm
cp lib/DBD/Gofer/Policy/Base.pm blib/lib/DBD/Gofer/Policy/Base.pm
cp lib/DBD/Sponge.pm blib/lib/DBD/Sponge.pm
cp lib/DBD/Gofer/Policy/pedantic.pm blib/lib/DBD/Gofer/Policy/pedantic.pm
cp lib/DBI/Gofer/Transport/pipeone.pm blib/lib/DBI/Gofer/Transport/pipeone.pm
cp lib/DBI/W32ODBC.pm blib/lib/DBI/W32ODBC.pm
cp lib/DBD/Gofer/Transport/null.pm blib/lib/DBD/Gofer/Transport/null.pm
cp lib/Bundle/DBI.pm blib/lib/Bundle/DBI.pm
cp TASKS.pod blib/lib/TASKS.pod
cp lib/DBI/Profile.pm blib/lib/DBI/Profile.pm
cp lib/DBI/ProfileDumper.pm blib/lib/DBI/ProfileDumper.pm
....

make test
[root@croracle02 DBI-1.609]# make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01basics................ok
4/130 skipped: developer tests
t/02dbidrv................ok
t/03handle................ok
....
[root@croracle02 DBI-1.609]# make install

校驗腳本:
[root@croracle02 software]# cat perl-module.pl
#!/usr/bin/perl
use ExtUtils::Installed;

my $inst = ExtUtils::Installed->new();
print join "\n",$inst->modules();
[root@croracle02 software]# ./perl-module.pl
DBI <--OK
Perl
[root@croracle02 software]#

B Install DBD-mysql
[root@croracle02 software]# tar xvfz DBD-mysql-4.012.tar.gz
DBD-mysql-4.012/
DBD-mysql-4.012/ChangeLog
DBD-mysql-4.012/constants.h
DBD-mysql-4.012/dbdimp.c
DBD-mysql-4.012/dbdimp.h
DBD-mysql-4.012/eg/
DBD-mysql-4.012/eg/._bug14979.pl
DBD-mysql-4.012/eg/bug14979.pl
DBD-mysql-4.012/eg/._bug21028.pl
DBD-mysql-4.012/eg/bug21028.pl
DBD-mysql-4.012/eg/bug30033.pl
DBD-mysql-4.012/eg/bug30033pg.pl
DBD-mysql-4.012/eg/decimal_test.pl
DBD-mysql-4.012/eg/issue21946.pl
DBD-mysql-4.012/eg/prepare_memory_usage.pl
DBD-mysql-4.012/eg/proc_example1.pl
DBD-mysql-4.012/eg/proc_example2.pl
DBD-mysql-4.012/eg/proc_example2a.pl
DBD-mysql-4.012/eg/proc_example2b.pl
DBD-mysql-4.012/eg/proc_example3.pl
DBD-mysql-4.012/eg/proc_example4.pl
DBD-mysql-4.012/INSTALL.html
DBD-mysql-4.012/lib/
DBD-mysql-4.012/lib/Bundle/
DBD-mysql-4.012/lib/Bundle/DBD/
DBD-mysql-4.012/lib/Bundle/DBD/mysql.pm
DBD-mysql-4.012/lib/DBD/
DBD-mysql-4.012/lib/DBD/mysql/
DBD-mysql-4.012/lib/DBD/mysql/GetInfo.pm
DBD-mysql-4.012/lib/DBD/mysql/INSTALL.pod
DBD-mysql-4.012/lib/DBD/mysql.pm
DBD-mysql-4.012/Makefile.PL
DBD-mysql-4.012/Makefile.PL.embedded
DBD-mysql-4.012/MANIFEST
DBD-mysql-4.012/MANIFEST.SKIP
DBD-mysql-4.012/META.yml
DBD-mysql-4.012/myld
DBD-mysql-4.012/mysql.xs
DBD-mysql-4.012/README
DBD-mysql-4.012/t/
DBD-mysql-4.012/t/00base.t
DBD-mysql-4.012/t/10connect.t
DBD-mysql-4.012/t/20createdrop.t
DBD-mysql-4.012/t/25lockunlock.t
DBD-mysql-4.012/t/29warnings.t
DBD-mysql-4.012/t/30insertfetch.t
DBD-mysql-4.012/t/31insertid.t
DBD-mysql-4.012/t/32insert_error.t
DBD-mysql-4.012/t/35limit.t
DBD-mysql-4.012/t/35prepare.t
DBD-mysql-4.012/t/40bindparam.t
DBD-mysql-4.012/t/40bindparam2.t
DBD-mysql-4.012/t/40blobs.t
DBD-mysql-4.012/t/40catalog.t
DBD-mysql-4.012/t/40keyinfo.t
DBD-mysql-4.012/t/40listfields.t
DBD-mysql-4.012/t/40nulls.t
DBD-mysql-4.012/t/40numrows.t
DBD-mysql-4.012/t/40server_prepare.t
DBD-mysql-4.012/t/40server_prepare_error.t
DBD-mysql-4.012/t/40types.t
DBD-mysql-4.012/t/41bindparam.t
DBD-mysql-4.012/t/41blobs_prepare.t
DBD-mysql-4.012/t/42bindparam.t
DBD-mysql-4.012/t/50chopblanks.t
DBD-mysql-4.012/t/50commit.t
DBD-mysql-4.012/t/51bind_type_guessing.t
DBD-mysql-4.012/t/55utf8.t
DBD-mysql-4.012/t/60leaks.t
DBD-mysql-4.012/t/65types.t
DBD-mysql-4.012/t/70takeimp.t
DBD-mysql-4.012/t/71impdata.t
DBD-mysql-4.012/t/75supported_sql.t
DBD-mysql-4.012/t/76multi_statement.t
DBD-mysql-4.012/t/80procs.t
DBD-mysql-4.012/t/lib.pl
DBD-mysql-4.012/t/mysql.dbtest
DBD-mysql-4.012/t/mysql.mtest
DBD-mysql-4.012/TODO
[root@croracle02 software]#

[root@croracle02 DBD-mysql-4.012]# perl Makefile.PL

PLEASE NOTE:

For 'make test' to run properly, you must ensure that the
database user 'root' can connect to your MySQL server
and has the proper privileges that these tests require such
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others.

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';

You can also optionally set the user to run 'make test' with:

perl Makefile.pl --testuser=username

I will use the following settings for compiling and testing:

cflags (mysql_config) = -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -DUNIV_LINUX
embedded (mysql_config) =
libs (mysql_config) = -rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lmygcc
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testsocket (default ) =
testuser (guessed ) = root

To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.

Checking if your kit is complete...
Looks good
Unrecognized argument in LIBS ignored: '-rdynamic'
Using DBI 1.609 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::mysql
[root@croracle02 DBD-mysql-4.012]#
[root@croracle02 DBD-mysql-4.012]# make
[root@croracle02 DBD-mysql-4.012]# make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base....................ok
t/10connect.................ok
t/20createdrop..............ok
t/25lockunlock..............ok
t/29warnings................ok
...
[root@croracle02 DBD-mysql-4.012]# make install
校驗:
[root@croracle02 software]# ./perl-module.pl
DBD::mysql
DBI
Perl[root@croracle02 software]#

c. Install XML-parser

[root@croracle02 software]# tar xvfz XML-Parser-2.36.tar.gz
XML-Parser-2.36/
XML-Parser-2.36/Changes
XML-Parser-2.36/Expat/
XML-Parser-2.36/Expat/encoding.h
XML-Parser-2.36/Expat/Expat.pm
XML-Parser-2.36/Expat/Expat.xs
XML-Parser-2.36/Expat/Makefile.PL
XML-Parser-2.36/Expat/typemap
XML-Parser-2.36/Makefile.PL
XML-Parser-2.36/MANIFEST
XML-Parser-2.36/META.yml
XML-Parser-2.36/Parser/
XML-Parser-2.36/Parser/Encodings/
XML-Parser-2.36/Parser/Encodings/big5.enc
XML-Parser-2.36/Parser/Encodings/euc-kr.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-2.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-3.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-4.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-5.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-7.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-8.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-9.enc
XML-Parser-2.36/Parser/Encodings/Japanese_Encodings.msg
XML-Parser-2.36/Parser/Encodings/README
XML-Parser-2.36/Parser/Encodings/windows-1250.enc
XML-Parser-2.36/Parser/Encodings/windows-1252.enc
XML-Parser-2.36/Parser/Encodings/x-euc-jp-jisx0221.enc
XML-Parser-2.36/Parser/Encodings/x-euc-jp-unicode.enc
XML-Parser-2.36/Parser/Encodings/x-sjis-cp932.enc
XML-Parser-2.36/Parser/Encodings/x-sjis-jdk117.enc
XML-Parser-2.36/Parser/Encodings/x-sjis-jisx0221.enc
XML-Parser-2.36/Parser/Encodings/x-sjis-unicode.enc
XML-Parser-2.36/Parser/LWPExternEnt.pl
XML-Parser-2.36/Parser/Style/
XML-Parser-2.36/Parser/Style/Debug.pm
XML-Parser-2.36/Parser/Style/Objects.pm
XML-Parser-2.36/Parser/Style/Stream.pm
XML-Parser-2.36/Parser/Style/Subs.pm
XML-Parser-2.36/Parser/Style/Tree.pm
XML-Parser-2.36/Parser.pm
XML-Parser-2.36/README
XML-Parser-2.36/samples/
XML-Parser-2.36/samples/canonical
XML-Parser-2.36/samples/canontst.xml
XML-Parser-2.36/samples/ctest.dtd
XML-Parser-2.36/samples/REC-xml-19980210.xml
XML-Parser-2.36/samples/xmlcomments
XML-Parser-2.36/samples/xmlfilter
XML-Parser-2.36/samples/xmlstats
XML-Parser-2.36/t/
XML-Parser-2.36/t/astress.t
XML-Parser-2.36/t/cdata.t
XML-Parser-2.36/t/decl.t
XML-Parser-2.36/t/defaulted.t
XML-Parser-2.36/t/encoding.t
XML-Parser-2.36/t/ext.ent
XML-Parser-2.36/t/ext2.ent
XML-Parser-2.36/t/external_ent.t
XML-Parser-2.36/t/file.t
XML-Parser-2.36/t/finish.t
XML-Parser-2.36/t/foo.dtd
XML-Parser-2.36/t/namespaces.t
XML-Parser-2.36/t/parament.t
XML-Parser-2.36/t/partial.t
XML-Parser-2.36/t/skip.t
XML-Parser-2.36/t/stream.t
XML-Parser-2.36/t/styles.t
[root@croracle02 software]#

[root@croracle02 XML-Parser-2.36]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for XML::Parser::Expat
Writing Makefile for XML::Parser
[root@croracle02 XML-Parser-2.36]# make
[root@croracle02 XML-Parser-2.36]# make test
make[1]: Entering directory `/root/software/XML-Parser-2.36/Expat'
make[1]: Leaving directory `/root/software/XML-Parser-2.36/Expat'
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/astress.........ok
t/cdata...........ok
t/decl............ok
t/defaulted.......ok
t/encoding........ok
t/external_ent....ok
t/file............ok
t/finish..........ok
t/namespaces......ok
t/parament........ok
t/partial.........ok
t/skip............ok
t/stream..........ok
t/styles..........ok
All tests successful.
Files=14, Tests=130, 1 wallclock secs ( 0.60 cusr + 0.32 csys = 0.92 CPU)
[root@croracle02 XML-Parser-2.36]#

[root@croracle02 XML-Parser-2.36]# make install
校驗:
[root@croracle02 software]# ./perl-module.pl
DBD::mysql
DBI
Perl
XML::Parser[root@croracle02 software]#

. 安裝 MySQL-ZRM
rpm -ivh MySQL-zrm-2.1-1.noarch.rpm --nodeps

[root@croracle02 software]# rpm -Uvh MySQL-zrm-2.1-1.noarch.rpm
warning: MySQL-zrm-2.1-1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 3c5d1c92
error: Failed dependencies:
perl(XML::Parser) is needed by MySQL-zrm-2.1-1.noarch
perl-DBI is needed by MySQL-zrm-2.1-1.noarch
[root@croracle02 software]#
[root@croracle02 software]# rpm -ivh MySQL-zrm-2.1-1.noarch.rpm --nodeps
warning: MySQL-zrm-2.1-1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 3c5d1c92
Preparing... ########################################### [100%]
1:MySQL-zrm ########################################### [100%]
Checking and Migrating old ZRM data
[root@croracle02 software]#

. 創建備份腳本 Create directory and copy default configuration file to create the first ZRM backup set “DailyBackupDB1”

[root@croracle02 software]# mkdir /etc/mysql-zrm/DailyBackupDB1
[root@croracle02 software]#

cp /etc/mysql-zrm/mysql-zrm.conf /etc/mysql-zrm/DailyBackupDB1

[root@croracle02 software]# cp /etc/mysql-zrm/mysql-zrm.conf /etc/mysql-zrm/DailyBackupDB1
[root@croracle02 software]#

. Edit the /etc/mysql-zrm/DailyBackupDB1/mysql-zrm.conf and make the changes to the lines below:
配置信息編輯:
compress=1
compress-plugin=/usr/bin/gzip
encrypt=1
encrypt-plugin="/usr/share/mysql-zrm/plugins/encrypt.pl"
databases=moviesinnodb moviesmyisam
user="backup-user"
password="password"
host="172.16.1.162"
mailto="mysqldba@company.com"
copy-plugin=/usr/share/mysql-zrm/plugins/socket-copy.pl

.Create file that contains the passphrase used for backup encryption
密碼詞創建:
[root@croracle02 DailyBackupDB1]# touch /etc/mysql-zrm/.passphrase
[root@croracle02 DailyBackupDB1]# echo encryptpass > /etc/mysql-zrm/.passphrase
[root@croracle02 DailyBackupDB1]# chmod 700 /etc/mysql-zrm/.passphrase
[root@croracle02 DailyBackupDB1]#

.In order for encryption to work the /root/.gnupg directory must me created

[root@croracle02 DailyBackupDB1]# mkdir /root/.gnupg/
[root@croracle02 DailyBackupDB1]# chmod 600 /root/.gnupg/
[root@croracle02 DailyBackupDB1]#

2. Prepare “172.16.1.162準備” for backup by ZRM

[root@CRRACTEST ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

. 162mysql 創建用戶及進行授權
GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'172.16.1.166' IDENTIFIED BY 'password';

mysql> GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'172.16.1.166' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.08 sec)

mysql>

. Give Privileges to "backup-user" to connect locally from "162"
本地授權

GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'172.16.1.162' IDENTIFIED BY 'password';

GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'localhost' IDENTIFIED BY 'password';

mysql> GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'172.16.1.162' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql>

mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

mysql>

校驗
[root@CRRACTEST ~]# mysql -ubackup-user -ppassword
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
162 沒有問題

f. Enable binary logging on the MySQL server by editing the /etc/my.cnf file and specifying the “log-bin” parameter under the “[mysqld]” section. This will enable incremental backups of the InnoDB database “moviesinnodb” .
編輯 162 /etc/my.cnf 文件
log-bin=/var/lib/mysql/mysql-bin

[root@CRRACTEST init.d]# ./mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
[root@CRRACTEST init.d]# cd /var/lib/mysql/
[root@CRRACTEST mysql]# ls
crontest ib_logfile0 importtest mysql-bin.000001 mysql.sock test2
ibdata1 ib_logfile1 mysql mysql-bin.index test
[root@CRRACTEST mysql]#

在162上安裝 zrm client端軟件:
[root@CRRACTEST ~]# rpm -Uvh MySQL-zrm-client-2.1-1.noarch.rpm
warning: MySQL-zrm-client-2.1-1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 3c5d1c92
Preparing... ########################################### [100%]
1:MySQL-zrm-client ########################################### [100%]
Aug 14 2009 15:27:41: Reloading xinetd configuration...Reloading configuration: [ OK ]
[root@CRRACTEST ~]#

Configure firewall for backups between “166” and “db1.162”
配置防火牆,因為是測試這裡沒有使用防火牆

4. Setting Up ZRM on “166” to backup the (moviesmyisam) database running on “172.16.1.165”
(ssh-copy模式)的配置

[root@croracle02 DailyBackupDB1]# mkdir /etc/mysql-zrm/DailyBackupDB2
[root@croracle02 DailyBackupDB1]# cp /etc/mysql-zrm/mysql-zrm.conf /etc/mysql-zrm/DailyBackupDB2

配置文件的內容:
[root@croracle02 DailyBackupDB2]# cat mysql-zrm.conf |grep -v ^# |grep -v ^$
compress=1
compress-plugin=/usr/bin/gzip
encrypt=1
encrypt-plugin="/usr/share/mysql-zrm/plugins/encrypt.pl"
databases=moviesmyisam
user="backup-user"
password="password"
host="172.16.1.165"
mailto=username@company.com
copy-plugin=/usr/share/mysql-zrm/plugins/socket-copy.pl
ssh-user="mysql"

Create ssh keys for user “root” on “166”
創建ssh public key
[root@croracle02 DailyBackupDB2]# mkdir /root/.ssh
mkdir: cannot create directory `/root/.ssh': File exists
[root@croracle02 DailyBackupDB2]# chmod 700 /root/.ssh
[root@croracle02 DailyBackupDB2]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
b8:0f:09:0f:bf:e8:08:cc:28:23:3a:10:85:76:73:f3 root@croracle02.localdomain
[root@croracle02 DailyBackupDB2]#

. Set up firewall for backups between “166” and “165”
這裡是測試環境沒有設置防火牆

權限設定
[root@croracle01 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'172.16.1.165' IDENTIFIED BY 'password';
GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'localhost' IDENTIFIED BY 'password';

GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'localhost' IDENTIFIED BY 'password';

mysql> GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'172.16.1.166' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.33 sec)

GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'croracle02.localdomain' IDENTIFIED BY 'password';

mysql>

mysql> GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'172.16.1.165' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT LOCK TABLES, SELECT, FILE, CREATE, DROP, INDEX, SHUTDOWN, ALTER, INSERT, SUPER, RELOAD ON *.* TO 'backup-user'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql>

mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)

mysql>
校驗
[root@croracle01 ~]# mysql -ubackup-user -ppassword
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

. The default “mysql” user will be used to connect to "db2.zmanda.com" and needs to be created if doesn't already exist.
檢查mysql用戶是否存在

mysql:x:100:103:MySQL server:/var/lib/mysql:/bin/bash

. Create the .ssh directory where the public ssh key will be stored. This user is needed to establish a connection from the MySQL-ZRM server “166”.
創建相應的ssh public key 存放路徑并授權
[root@croracle01 ~]# mkdir /var/lib/mysql/.ssh
[root@croracle01 ~]# chown mysql /var/lib/mysql/.ssh
[root@croracle01 ~]# chmod 700 /var/lib/mysql/.ssh
[root@croracle01 ~]#

. Copy the contents of /root/.ssh/id_rsa.pub file located on 166 to the file “authorized_keys” on db2.165
On server “166” run:
[root@quartz .ssh]# scp /root/.ssh/id_rsa.pub root@172.16.1.165:/var/lib/mysql/.ssh/authorized_keys

[root@croracle02 ~]# scp /root/.ssh/id_rsa.pub root@172.16.1.165:/var/lib/mysql/.ssh/authorized_keys
root@172.16.1.165's password:
id_rsa.pub 100% 409 0.4KB/s 00:00
[root@croracle02 ~]#

[root@croracle01 ~]# chmod 600 /var/lib/mysql/.ssh/authorized_keys
[root@croracle01 ~]# chown mysql /var/lib/mysql/.ssh/authorized_keys
[root@croracle01 ~]#

db1 創建測試數據
[root@CRRACTEST ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database moviesinnodb
-> ;
Query OK, 1 row affected (0.00 sec)

mysql> use moviesinnodb
Database changed
mysql> create table db1_test(id int);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into db1_test values(1),(2),(3),(4);
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0

mysql> select * from db1_test;
+------+
| id |
+------+
| 1 |
| 2 |
| 3 |
| 4 |
+------+
4 rows in set (0.00 sec)

mysql>

mysql> select database();
+--------------+
| database() |
+--------------+
| moviesinnodb |
+--------------+
1 row in set (0.00 sec)

mysql>
mysql> create database moviesmyisam;
Query OK, 1 row affected (0.00 sec)

mysql> use moviesmyisam
Database changed
mysql> create table db1_test2 (id int);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into db1_test2 values(5),(6),(7),(8);
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0

mysql> select * from db1_test2;
+------+
| id |
+------+
| 5 |
| 6 |
| 7 |
| 8 |
+------+
4 rows in set (0.00 sec)

mysql>

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| crontest |
| importtest |
| moviesinnodb |
| moviesmyisam |
| mysql |
| test |
| test2 |
+--------------------+
8 rows in set (0.00 sec)

mysql>

. Execute a test backup of databases on both “162” and “165”
執行backup測試(162,165)
. Execute backup of databases (moviesinnodb / moviesmyisam) on server “162”
先在162上進行試驗:
mysql-zrm-scheduler --backup-set DailyBackupDB1 --backup-level 0 --now
[root@croracle02 ~]# mysql-zrm-scheduler --backup-set DailyBackupDB1 --backup-level 0 --now
schedule:INFO: ZRM for MySQL Community Edition - version 2.1
Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log
backup:INFO: ZRM for MySQL Community Edition - version 2.1
DailyBackupDB1:backup:INFO: START OF BACKUP
DailyBackupDB1:backup:INFO: PHASE START: Initialization
DailyBackupDB1:backup:INFO: backup-set=DailyBackupDB1
DailyBackupDB1:backup:INFO: backup-date=20090813071855
DailyBackupDB1:backup:INFO: mysql-server-os=Linux/Unix
DailyBackupDB1:backup:INFO: backup-type=regular
DailyBackupDB1:backup:INFO: host=172.16.1.162
DailyBackupDB1:backup:INFO: backup-date-epoch=1250119135
DailyBackupDB1:backup:INFO: mysql-zrm-version=ZRM for MySQL Community Edition - version 2.1
DailyBackupDB1:backup:INFO: mysql-version=5.0.45-log
DailyBackupDB1:backup:INFO: backup-directory=/var/lib/mysql-zrm/DailyBackupDB1/20090813071855
DailyBackupDB1:backup:INFO: backup-level=0
DailyBackupDB1:backup:INFO: backup-mode=raw
DailyBackupDB1:backup:INFO: PHASE END: Initialization
DailyBackupDB1:backup:INFO: PHASE START: Running pre backup plugin
DailyBackupDB1:backup:INFO: PHASE END: Running pre backup plugin
DailyBackupDB1:backup:INFO: PHASE START: Flushing logs
DailyBackupDB1:backup:INFO: PHASE END: Flushing logs
DailyBackupDB1:backup:INFO: PHASE START: Find table type
DailyBackupDB1:backup:INFO: PHASE END: Find table type
DailyBackupDB1:backup:INFO: PHASE START: Creating raw backup
DailyBackupDB1:backup:INFO: raw-databases=moviesinnodb moviesmyisam
DailyBackupDB1:backup:INFO: PHASE END: Creating raw backup
DailyBackupDB1:backup:INFO: PHASE START: Calculating backup size & checksums
DailyBackupDB1:backup:INFO: next-binlog=mysql-bin.000002
DailyBackupDB1:backup:INFO: backup-size=0.03 MB
DailyBackupDB1:backup:INFO: PHASE END: Calculating backup size & checksums
DailyBackupDB1:backup:INFO: PHASE START: Compression/Encryption
DailyBackupDB1:backup:INFO: compress=/usr/bin/gzip
DailyBackupDB1:backup:INFO: encrypt=/usr/share/mysql-zrm/plugins/encrypt.pl
DailyBackupDB1:backup:INFO: decrypt-option=-d
DailyBackupDB1:backup:INFO: backup-size-compressed=0.00 MB
DailyBackupDB1:backup:INFO: PHASE END: Compression/Encryption
DailyBackupDB1:backup:INFO: read-locks-time=00:00:26
DailyBackupDB1:backup:INFO: flush-logs-time=00:00:05
DailyBackupDB1:backup:INFO: compress-encrypt-time=00:00:00
DailyBackupDB1:backup:INFO: backup-time=00:01:01
DailyBackupDB1:backup:INFO: backup-status=Backup succeeded
DailyBackupDB1:backup:INFO: Backup succeeded
DailyBackupDB1:backup:INFO: PHASE START: Running post backup plugin
DailyBackupDB1:backup:INFO: PHASE END: Running post backup plugin
DailyBackupDB1:backup:INFO: PHASE START: Mailing backup report
DailyBackupDB1:backup:INFO: PHASE END: Mailing backup report
DailyBackupDB1:backup:INFO: PHASE START: Cleanup
DailyBackupDB1:backup:INFO: PHASE END: Cleanup
DailyBackupDB1:backup:INFO: END OF BACKUP
/usr/bin/mysql-zrm started successfully
[root@croracle02 ~]#
備份成功!

建造db2的測試數據
[root@croracle01 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database moviesinnodb;
Query OK, 1 row affected (0.02 sec)

mysql> use moviesinnodb
Database changed
mysql> create table db2_test (id int);
Query OK, 0 rows affected (0.14 sec)

mysql> insert into db2_test values(9),(10),(11),(12);
Query OK, 4 rows affected (0.01 sec)
Records: 4 Duplicates: 0 Warnings: 0

mysql> select * from db2_test;
+------+
| id |
+------+
| 9 |
| 10 |
| 11 |
| 12 |
+------+
4 rows in set (0.01 sec)

mysql>

--DB2 安裝
[root@croracle01 ~]# rpm -Uvh MySQL-zrm-client-2.1-1.noarch.rpm
warning: MySQL-zrm-client-2.1-1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 3c5d1c92
Preparing... ########################################### [100%]
1:MySQL-zrm-client ########################################### [100%]
Aug 15 2009 00:08:42: Reloading xinetd configuration...Reloading configuration: [ OK ]
[root@croracle01 ~]#

mysql-zrm-scheduler --backup-set DailyBackupDB2 --backup-level 0 --now
備份測試:
[root@croracle02 DailyBackupDB2]# mysql-zrm-scheduler --backup-set DailyBackupDB2 --backup-level 0 --now --verbose
schedule:INFO: ZRM for MySQL Community Edition - version 2.1
schedule:INFO: Reading options from file /etc/mysql-zrm/mysql-zrm.conf
DailyBackupDB2:schedule:INFO: Reading options from file /etc/mysql-zrm/DailyBackupDB2/mysql-zrm.conf
DailyBackupDB2:schedule:WARNING: Could not open file /etc/mysql-zrm/DailyBackupDB2/last_backup. No such file or directory
Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log
backup:INFO: ZRM for MySQL Community Edition - version 2.1
DailyBackupDB2:backup:INFO: START OF BACKUP
DailyBackupDB2:backup:INFO: PHASE START: Initialization
DailyBackupDB2:backup:INFO: backup-set=DailyBackupDB2
DailyBackupDB2:backup:INFO: backup-date=20090813083956
DailyBackupDB2:backup:INFO: mysql-server-os=Linux/Unix
DailyBackupDB2:backup:INFO: backup-type=regular
DailyBackupDB2:backup:INFO: host=172.16.1.165
DailyBackupDB2:backup:INFO: backup-date-epoch=1250123996
DailyBackupDB2:backup:INFO: mysql-zrm-version=ZRM for MySQL Community Edition - version 2.1
DailyBackupDB2:backup:INFO: mysql-version=5.1.36-community-log
DailyBackupDB2:backup:INFO: backup-directory=/var/lib/mysql-zrm/DailyBackupDB2/20090813083956
DailyBackupDB2:backup:INFO: backup-level=0
DailyBackupDB2:backup:INFO: backup-mode=raw
DailyBackupDB2:backup:INFO: PHASE END: Initialization
DailyBackupDB2:backup:INFO: PHASE START: Running pre backup plugin
DailyBackupDB2:backup:INFO: PHASE END: Running pre backup plugin
DailyBackupDB2:backup:INFO: PHASE START: Flushing logs
DailyBackupDB2:backup:INFO: PHASE END: Flushing logs
DailyBackupDB2:backup:INFO: PHASE START: Find table type
DailyBackupDB2:backup:INFO: PHASE END: Find table type
DailyBackupDB2:backup:INFO: PHASE START: Creating raw backup
DailyBackupDB2:backup:ERROR: Output of command: 'mysqlhotcopy' is {
Can't locate DBI.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/bin/mysqlhotcopy line 8.
BEGIN failed--compilation aborted at /usr/bin/mysqlhotcopy line 8.
mysqlhotcopy on host 172.16.1.165 failed at /usr/share/mysql-zrm/plugins/ssh-copy.pl line 322.
}
DailyBackupDB2:backup:ERROR: mysqlhotcopy did not succeed. Command used is /usr/share/mysql-zrm/plugins/ssh-copy.pl --mysqlhotcopy --user="backup-user" --password="*****" --host="172.16.1.165" --quiet moviesmyisam "/var/lib/mysql-zrm/DailyBackupDB2/20090813083956" > /tmp/BgXcvtmDX9 2>&1 Return value is 512
DailyBackupDB2:backup:INFO: PHASE START: Cleanup
DailyBackupDB2:backup:INFO: backup-status=Backup failed
DailyBackupDB2:backup:INFO: Backup failed
DailyBackupDB2:backup:INFO: PHASE END: Cleanup
DailyBackupDB2:backup:INFO: END OF BACKUP
ERROR: /usr/bin/mysql-zrm did not finish successfully

[root@croracle02 DailyBackupDB2]#

問題解決:

DBD-mysql-4.012.tar.gz DBI-1.609.tar.gz XML-Parser-2.36.tar.gz
安裝在db2.165上就可以了

[root@croracle02 ~]# mysql-zrm-scheduler --backup-set DailyBackupDB2 --backup-level 0 --now
schedule:INFO: ZRM for MySQL Community Edition - version 2.1
Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log
backup:INFO: ZRM for MySQL Community Edition - version 2.1
DailyBackupDB2:backup:INFO: START OF BACKUP
DailyBackupDB2:backup:INFO: PHASE START: Initialization
DailyBackupDB2:backup:INFO: backup-set=DailyBackupDB2
DailyBackupDB2:backup:INFO: backup-date=20090816175909
DailyBackupDB2:backup:INFO: mysql-server-os=Linux/Unix
DailyBackupDB2:backup:INFO: backup-type=regular
DailyBackupDB2:backup:INFO: host=172.16.1.165
DailyBackupDB2:backup:INFO: backup-date-epoch=1250416749
DailyBackupDB2:backup:INFO: mysql-zrm-version=ZRM for MySQL Community Edition - version 2.1
DailyBackupDB2:backup:INFO: mysql-version=5.1.36-community-log
DailyBackupDB2:backup:INFO: backup-directory=/var/lib/mysql-zrm/DailyBackupDB2/20090816175909
DailyBackupDB2:backup:INFO: backup-level=0
DailyBackupDB2:backup:INFO: backup-mode=raw
DailyBackupDB2:backup:INFO: PHASE END: Initialization
DailyBackupDB2:backup:INFO: PHASE START: Running pre backup plugin
DailyBackupDB2:backup:INFO: PHASE END: Running pre backup plugin
DailyBackupDB2:backup:INFO: PHASE START: Flushing logs
DailyBackupDB2:backup:INFO: PHASE END: Flushing logs
DailyBackupDB2:backup:INFO: PHASE START: Find table type
DailyBackupDB2:backup:INFO: PHASE END: Find table type
DailyBackupDB2:backup:INFO: PHASE START: Creating raw backup
DailyBackupDB2:backup:INFO: raw-databases=moviesmyisam
DailyBackupDB2:backup:INFO: PHASE END: Creating raw backup
DailyBackupDB2:backup:INFO: PHASE START: Calculating backup size & checksums
DailyBackupDB2:backup:INFO: next-binlog=mysql-bin.000027
DailyBackupDB2:backup:INFO: backup-size=0.02 MB
DailyBackupDB2:backup:INFO: PHASE END: Calculating backup size & checksums
DailyBackupDB2:backup:INFO: PHASE START: Compression/Encryption
DailyBackupDB2:backup:INFO: compress=/usr/bin/gzip
DailyBackupDB2:backup:INFO: encrypt=/usr/share/mysql-zrm/plugins/encrypt.pl
DailyBackupDB2:backup:INFO: decrypt-option=-d
DailyBackupDB2:backup:INFO: backup-size-compressed=0.00 MB
DailyBackupDB2:backup:INFO: PHASE END: Compression/Encryption
DailyBackupDB2:backup:INFO: read-locks-time=00:00:04
DailyBackupDB2:backup:INFO: flush-logs-time=00:00:00
DailyBackupDB2:backup:INFO: compress-encrypt-time=00:00:10
DailyBackupDB2:backup:INFO: backup-time=00:00:05
DailyBackupDB2:backup:INFO: backup-status=Backup succeeded
DailyBackupDB2:backup:INFO: Backup succeeded
DailyBackupDB2:backup:INFO: PHASE START: Running post backup plugin
DailyBackupDB2:backup:INFO: PHASE END: Running post backup plugin
DailyBackupDB2:backup:INFO: PHASE START: Mailing backup report
DailyBackupDB2:backup:INFO: PHASE END: Mailing backup report
DailyBackupDB2:backup:INFO: PHASE START: Cleanup
DailyBackupDB2:backup:INFO: PHASE END: Cleanup
DailyBackupDB2:backup:INFO: END OF BACKUP
/usr/bin/mysql-zrm started successfully
[root@croracle02 ~]#

Verify both backups and check performance stats
檢查狀態:

[root@croracle02 ~]# mysql-zrm --action verify-backup --backup-set DailyBackupDB1
verify-backup:INFO: ZRM for MySQL Community Edition - version 2.1
DailyBackupDB1:verify-backup:INFO: Verification successful
[root@croracle02 ~]# mysql-zrm --action verify-backup --backup-set DailyBackupDB2
verify-backup:INFO: ZRM for MySQL Community Edition - version 2.1
DailyBackupDB2:verify-backup:INFO: Verification successful
[root@croracle02 ~]#

[root@croracle02 ~]# mysql-zrm-reporter --show backup-performance-info
reporter:WARNING: Backup root directory not specified, Assigning default value as /var/lib/mysql-zrm

REPORT TYPE : backup-performance-info

backup_set backup_date backup_level backup_size backup_size_compressed backup_time backup_type compress_encrypt_time
----------------------------------------------------------------------------------------------------------------------------------------------------------------
DailyBackupDB2 Sun 16 Aug 2009 05:59:09 0 0.02 MB 0.00 MB 00:00:05 regular 00:00:10
PM HKT
DailyBackupDB2 Sun 16 Aug 2009 05:55:40 0 ---- ---- ---- regular ----
PM HKT
DailyBackupDB2 Sun 16 Aug 2009 05:44:05 0 ---- ---- ---- regular ----
PM HKT
DailyBackupDB2 Thu 13 Aug 2009 10:28:06 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 10:00:20 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 09:36:08 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 09:30:18 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:59:15 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:58:11 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:39:56 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:37:34 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:28:16 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:23:46 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:12:19 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:05:53 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:04:56 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB2 Thu 13 Aug 2009 08:00:30 0 ---- ---- ---- regular ----
AM HKT
DailyBackupDB1 Thu 13 Aug 2009 07:18:55 0 0.03 MB 0.00 MB 00:01:01 regular 00:00:00
AM HKT
[root@croracle02 ~]#

配置自動工作:
Setup Automated backups using ZRM scheduler
a. Configure automated Full and Incremental backups for DailyBackupDB1. Incremental Mon-Fri at 1:00am and Full on Saturday 1:00am.

[root@croracle02 ~]# mysql-zrm-scheduler --add --interval weekly --start-time 1:00 --day-of-week 1-5 --backup-level 1 --backup-set DailyBackupDB1
schedule:INFO: ZRM for MySQL Community Edition - version 2.1
Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log
DONE
[root@croracle02 ~]#

[root@croracle02 ~]# mysql-zrm-scheduler --add --interval weekly --start-time 1:00 --day-of-week 6 --backup-level 0 --backup-set DailyBackupDB1
schedule:INFO: ZRM for MySQL Community Edition - version 2.1
Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log
DONE
[root@croracle02 ~]#

[root@croracle02 ~]# mysql-zrm-scheduler --add --interval weekly --start-time 1:00 --day-of-week 1-5 --backup-level 0 --backup-set DailyBackupDB2
schedule:INFO: ZRM for MySQL Community Edition - version 2.1
Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log
DONE
[root@croracle02 ~]#

[root@croracle02 ~]# mysql-zrm-scheduler --query
schedule:INFO: ZRM for MySQL Community Edition - version 2.1
Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log
0 1 * * 1-5 /usr/bin/zrm-pre-scheduler --action backup --backup-set DailyBackupDB1 --backup-level 1 --interval weekly
0 1 * * 6 /usr/bin/zrm-pre-scheduler --action backup --backup-set DailyBackupDB1 --backup-level 0 --interval weekly
0 1 * * 1-5 /usr/bin/zrm-pre-scheduler --action backup --backup-set DailyBackupDB2 --backup-level 0 --interval weekly
[root@croracle02 ~]#

Perform a test recovery of the databases on both database servers

[root@croracle02 ~]# mysql-zrm-reporter --show restore-info --where backup-set=DailyBackupDB1
reporter:WARNING: Backup root directory not specified, Assigning default value as /var/lib/mysql-zrm

REPORT TYPE : restore-info

backup_set backup_date backup_level backup_directory backup_status comment
-----------------------------------------------------------------------------------------------------------------------------------------------------
DailyBackupDB1 Thu 13 Aug 2009 07:18:55 0 /var/lib/mysql-zrm/DailyBackupDB1/200908 Backup succeeded ----
AM HKT 13071855
[root@croracle02 ~]#

[root@croracle02 ~]# mysql-zrm-reporter --show restore-info --where backup-set=DailyBackupDB2
reporter:WARNING: Backup root directory not specified, Assigning default value as /var/lib/mysql-zrm

REPORT TYPE : restore-info

backup_set backup_date backup_level backup_directory backup_status comment
-----------------------------------------------------------------------------------------------------------------------------------------------------
DailyBackupDB2 Sun 16 Aug 2009 05:59:09 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup succeeded ----
PM HKT 16175909
DailyBackupDB2 Sun 16 Aug 2009 05:55:40 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
PM HKT 16175540
DailyBackupDB2 Sun 16 Aug 2009 05:44:05 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
PM HKT 16174405
DailyBackupDB2 Thu 13 Aug 2009 10:28:06 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13102806
DailyBackupDB2 Thu 13 Aug 2009 10:00:20 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13100020
DailyBackupDB2 Thu 13 Aug 2009 09:36:08 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13093608
DailyBackupDB2 Thu 13 Aug 2009 09:30:18 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13093018
DailyBackupDB2 Thu 13 Aug 2009 08:59:15 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13085915
DailyBackupDB2 Thu 13 Aug 2009 08:58:11 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13085811
DailyBackupDB2 Thu 13 Aug 2009 08:39:56 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13083956
DailyBackupDB2 Thu 13 Aug 2009 08:37:34 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13083734
DailyBackupDB2 Thu 13 Aug 2009 08:28:16 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13082816
DailyBackupDB2 Thu 13 Aug 2009 08:23:46 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13082346
DailyBackupDB2 Thu 13 Aug 2009 08:12:19 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13081219
DailyBackupDB2 Thu 13 Aug 2009 08:05:53 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13080553
DailyBackupDB2 Thu 13 Aug 2009 08:04:56 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13080456
DailyBackupDB2 Thu 13 Aug 2009 08:00:30 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13080030
[root@croracle02 ~]#

恢復實驗:

Perform a test recovery of the databases on both database servers

先將db1 中的database刪除,模擬數據庫被毀掉

[root@CRRACTEST ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.0.45-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| crontest |
| importtest |
| moviesinnodb |
| moviesmyisam |
| mysql |
| test |
| test2 |
+--------------------+
8 rows in set (0.06 sec)

mysql> drop database moviesinnodb;
Query OK, 1 row affected (0.07 sec)

mysql> drop database moviesmyisam;
Query OK, 1 row affected (0.01 sec)

mysql>

Run this command to view restore information information for backup set DailyBackupDB1

[root@croracle02 ~]# mysql-zrm-reporter --show restore-info --where backup-set=DailyBackupDB1
reporter:WARNING: Backup root directory not specified, Assigning default value as /var/lib/mysql-zrm

REPORT TYPE : restore-info

backup_set backup_date backup_level backup_directory backup_status comment
-----------------------------------------------------------------------------------------------------------------------------------------------------
DailyBackupDB1 Mon 17 Aug 2009 01:00:03 1 /var/lib/mysql-zrm/DailyBackupDB1/200908 Backup succeeded ----
AM HKT 17010003
DailyBackupDB1 Thu 13 Aug 2009 07:18:55 0 /var/lib/mysql-zrm/DailyBackupDB1/200908 Backup succeeded ----
AM HKT 13071855
[root@croracle02 ~]#

mysql-zrm --action restore --backup-set DailyBackupDB1 --source-directory /var/lib/mysql-zrm/DailyBackupDB1/20090813071855

[root@croracle02 ~]# mysql-zrm --action restore --backup-set DailyBackupDB1 --source-directory /var/lib/mysql-zrm/DailyBackupDB1/20090813071855
restore:INFO: ZRM for MySQL Community Edition - version 2.1
DailyBackupDB1:restore:INFO: Restored database from raw backup: moviesinnodb
DailyBackupDB1:restore:INFO: Restored database from raw backup: moviesmyisam
DailyBackupDB1:restore:INFO: Restore done in 3 seconds.
MySQL server has been shutdown. Please restart after verification.

[root@CRRACTEST init.d]# ./mysqld restart
Stopping MySQL: [FAILED]
Starting MySQL: [ OK ]
[root@CRRACTEST init.d]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.45-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| crontest |
| importtest |
| moviesinnodb |
| moviesmyisam |
| mysql |
| test |
| test2 |
+--------------------+
8 rows in set (0.01 sec)

mysql>

[root@croracle02 ~]# mysql-zrm-reporter --show restore-info --where backup-set=DailyBackupDB2
reporter:WARNING: Backup root directory not specified, Assigning default value as /var/lib/mysql-zrm

REPORT TYPE : restore-info

backup_set backup_date backup_level backup_directory backup_status comment
-----------------------------------------------------------------------------------------------------------------------------------------------------
DailyBackupDB2 Mon 17 Aug 2009 01:00:03 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup succeeded ----
AM HKT 17010003
DailyBackupDB2 Sun 16 Aug 2009 05:59:09 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup succeeded ----
PM HKT 16175909
DailyBackupDB2 Sun 16 Aug 2009 05:55:40 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
PM HKT 16175540
DailyBackupDB2 Sun 16 Aug 2009 05:44:05 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
PM HKT 16174405
DailyBackupDB2 Thu 13 Aug 2009 10:28:06 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13102806
DailyBackupDB2 Thu 13 Aug 2009 10:00:20 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13100020
DailyBackupDB2 Thu 13 Aug 2009 09:36:08 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13093608
DailyBackupDB2 Thu 13 Aug 2009 09:30:18 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13093018
DailyBackupDB2 Thu 13 Aug 2009 08:59:15 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13085915
DailyBackupDB2 Thu 13 Aug 2009 08:58:11 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13085811
DailyBackupDB2 Thu 13 Aug 2009 08:39:56 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13083956
DailyBackupDB2 Thu 13 Aug 2009 08:37:34 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13083734
DailyBackupDB2 Thu 13 Aug 2009 08:28:16 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13082816
DailyBackupDB2 Thu 13 Aug 2009 08:23:46 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13082346
DailyBackupDB2 Thu 13 Aug 2009 08:12:19 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13081219
DailyBackupDB2 Thu 13 Aug 2009 08:05:53 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13080553
DailyBackupDB2 Thu 13 Aug 2009 08:04:56 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13080456
DailyBackupDB2 Thu 13 Aug 2009 08:00:30 0 /var/lib/mysql-zrm/DailyBackupDB2/200908 Backup failed ----
AM HKT 13080030
[root@croracle02 ~]#

[root@croracle01 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 58
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| #mysql50#.ssh |
| moviesinnodb |
| moviesmyisam |
| mysql |
| replDB |
| test |
| test2 |
| zrmtest |
+--------------------+
9 rows in set (0.00 sec)

mysql>

mysql> drop database moviesmyisam;
Query OK, 1 row affected (0.02 sec)

mysql> drop database moviesinnodb;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| #mysql50#.ssh |
| mysql |
| replDB |
| test |
| test2 |
| zrmtest |
+--------------------+
7 rows in set (0.00 sec)

mysql>
mysql-zrm --action restore --backup-set DailyBackupDB2 --source-directory /var/lib/mysql-zrm/DailyBackupDB2/20090817010003

[root@croracle02 ~]# mysql-zrm --action restore --backup-set DailyBackupDB2 --source-directory /var/lib/mysql-zrm/DailyBackupDB2/20090817010003
restore:INFO: ZRM for MySQL Community Edition - version 2.1
DailyBackupDB2:restore:INFO: Restored database from raw backup: moviesmyisam
DailyBackupDB2:restore:INFO: Restore done in 1 seconds.
MySQL server has been shutdown. Please restart after verification.
[root@croracle02 ~]#

[root@croracle01 ~]#
[root@croracle01 init.d]# ./mysql start
Starting MySQL.. [ OK ]
[root@croracle01 init.d]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| #mysql50#.ssh |
| moviesmyisam |
| mysql |
| replDB |
| test |
| test2 |
| zrmtest |
+--------------------+
8 rows in set (0.00 sec)

mysql>

good luck!

常見google hacking

常見的google hacking 留一份備忘

. intext: 内页key word
. intitle: 标题key word
. cache: 页面存档
. define: 定义
. filetype: 文件类型
. info:基本信息
. inurl:网址包含
. link:链接
. site: 相关网站链接

2009年8月17日星期一

發現windows Live Writer不錯

試用一下,看看效果如何,感覺還是不錯的!

2009年8月13日星期四

The Solution: Zmanda Recovery Manager for Mysql 本地模式實驗

使用zmanda進行mysql的備份恢復管理
Zmanda Recovery Manager for mysql(ZRM for mysql) simplifies this essential part of database administration with an easy-to-use yet powerful framework for scheduling and monitoring backups and restores
要求:
Prerequisites:
. Mysql server installed and configured. Mysql server已經安裝和配置好了
. at least one running database. 至少一個可運行數據庫
. Mysql user with appropriate permissions(backup-user) Mysql用戶有恰當的權限
.. grant access to 'backup-user' in mysql with password 'pass123' 例如



cmd:
grant select, show view, create view, insert, update, create, drop, reload, shutdown, alter, super, lock tables, replication client on *.* to 'backup-user'@'localhost' identified by 'pass123';

--Mysql中創建該用戶
mysql> grant select, show view, create view, insert , update, create, drop, reload, shutdown, alter, super, lock tables, replication client on *.* to 'backup-user'@'localhost' identified by 'pass123';
Query OK, 0 rows affected (0.00 sec)
--檢查權限的設定
mysql> show grants for 'backup-user'
-> ;
ERROR 1141 (42000): There is no such grant defined for user 'backup-user' on host '%'
mysql> show grants for 'backup-user'@'localhost';
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for backup-user@localhost |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, CREATE, DROP, RELOAD, SHUTDOWN, ALTER, SUPER, LOCK TABLES, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW ON *.* TO 'backup-user'@'localhost' IDENTIFIED BY PASSWORD '*FB6E1F205D675BC29B052DB14CCEFE7759C5FF7E' |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql>

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>


ZRM 2.1 for mysql also requires perl-DBI as well as perl-XML-parser.
ZRM2.1要求Mysql的同時也要求perl-DBI 和 per-xml-parser

下載最新tar包
http://www.cpan.org/modules/by-module/DBD/
http://www.cpan.org/modules/by-module/DBD/DBI-1.609.tar.gz


[root@croracle03 software]# wget http://www.cpan.org/modules/by-module/DBD/DBI-1.609.tar.gz
--15:10:41-- http://www.cpan.org/modules/by-module/DBD/DBI-1.609.tar.gz
Resolving www.cpan.org... 66.39.76.93
Connecting to www.cpan.org|66.39.76.93|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 510309 (498K) [application/x-tar]
Saving to: `DBI-1.609.tar.gz'

100%[=======================================>] 510,309 163K/s in 3.1s

15:10:45 (163 KB/s) - `DBI-1.609.tar.gz' saved [510309/510309]


安裝perl-DBI

[root@croracle03 software]# cd DBI-1.609
[root@croracle03 DBI-1.609]# ls
Changes dbiproxy.PL dbixs_rev.pl MANIFEST TASKS.pod
dbd_xsh.h dbi_sql.h Driver.xst META.yml test.pl
dbilogstrip.PL dbivport.h Driver_xst.h Perl.xs TODO_2005.txt
DBI.pm DBI.xs ex README TODO_gofer.txt
dbipport.h DBIXS.h lib Roadmap.pod typemap
dbiprof.PL dbixs_rev.h Makefile.PL t
[root@croracle03 DBI-1.609]# perl Makefile.PL

*** Your LANG environment variable is set to 'en_US.UTF-8'
*** This may cause problems for some perl installations.
*** If you get test failures, please try again with LANG unset.
*** If that then works, please email dbi-dev@perl.org with details
*** including the output of 'perl -V'


*** You are using a perl configured with threading enabled.
*** You should be aware that using multiple threads is
*** not recommended for production environments.

Your perl was compiled with gcc (version 4.1.1 20070105 (Red Hat 4.1.1-52)), okay.
Creating test wrappers for DBI::PurePerl:
t/zvp_01basics.t
t/zvp_02dbidrv.t
t/zvp_03handle.t
t/zvp_04mods.t
t/zvp_05concathash.t
t/zvp_06attrs.t
t/zvp_07kids.t
t/zvp_08keeperr.t
t/zvp_09trace.t
t/zvp_10examp.t
t/zvp_11fetch.t
t/zvp_12quote.t
t/zvp_13taint.t
t/zvp_14utf8.t
t/zvp_15array.t
t/zvp_19fhtrace.t
t/zvp_20meta.t
t/zvp_30subclass.t
t/zvp_35thrclone.t (use threads)
t/zvp_40profile.t
t/zvp_41prof_dump.t
t/zvp_42prof_data.t
t/zvp_43prof_env.t
t/zvp_50dbm.t
t/zvp_60preparse.t
t/zvp_65transact.t
t/zvp_70callbacks.t
t/zvp_72childhandles.t
t/zvp_80proxy.t
t/zvp_85gofer.t
t/zvp_86gofer_fail.t
t/zvp_87gofer_cache.t
Creating test wrappers for DBD::Gofer:
t/zvg_01basics.t
t/zvg_02dbidrv.t
t/zvg_03handle.t
t/zvg_04mods.t
t/zvg_05concathash.t
t/zvg_06attrs.t
t/zvg_07kids.t
t/zvg_08keeperr.t
t/zvg_09trace.t
t/zvg_10examp.t
t/zvg_11fetch.t
t/zvg_12quote.t
t/zvg_13taint.t
t/zvg_14utf8.t
t/zvg_15array.t
t/zvg_19fhtrace.t
t/zvg_20meta.t
t/zvg_30subclass.t
t/zvg_35thrclone.t (use threads)
t/zvg_40profile.t
t/zvg_41prof_dump.t
t/zvg_42prof_data.t
t/zvg_43prof_env.t
t/zvg_50dbm.t
t/zvg_60preparse.t
t/zvg_65transact.t
t/zvg_70callbacks.t
t/zvg_72childhandles.t
t/zvg_80proxy.t
t/zvg_85gofer.t
t/zvg_86gofer_fail.t
t/zvg_87gofer_cache.t
Creating test wrappers for PurePerl & Gofer:
t/zvxgp_01basics.t
t/zvxgp_02dbidrv.t
t/zvxgp_03handle.t
t/zvxgp_04mods.t
t/zvxgp_05concathash.t
t/zvxgp_06attrs.t
t/zvxgp_07kids.t
t/zvxgp_08keeperr.t
t/zvxgp_09trace.t
t/zvxgp_10examp.t
t/zvxgp_11fetch.t
t/zvxgp_12quote.t
t/zvxgp_13taint.t
t/zvxgp_14utf8.t
t/zvxgp_15array.t
t/zvxgp_19fhtrace.t
t/zvxgp_20meta.t
t/zvxgp_30subclass.t
t/zvxgp_35thrclone.t (use threads)
t/zvxgp_40profile.t
t/zvxgp_41prof_dump.t
t/zvxgp_42prof_data.t
t/zvxgp_43prof_env.t
t/zvxgp_50dbm.t
t/zvxgp_60preparse.t
t/zvxgp_65transact.t
t/zvxgp_70callbacks.t
t/zvxgp_72childhandles.t
t/zvxgp_80proxy.t
t/zvxgp_85gofer.t
t/zvxgp_86gofer_fail.t
t/zvxgp_87gofer_cache.t
Checking if your kit is complete...
Looks good

I see you're using perl 5.008008 on x86_64-linux-thread-multi, okay.
Remember to actually *read* the README file!
Use 'make' to build the software (dmake or nmake on Windows).
Then 'make test' to execute self tests.
Then 'make install' to install the DBI and then delete this working
directory before unpacking and building any DBD::* drivers.

Writing Makefile for DBI
[root@croracle03 DBI-1.609]#



[root@croracle03 DBI-1.609]# perldoc DBI
x86_64-linux-thread-muUser:Contributed Perl Dx86m64-linux-thread-multi::DBI(3)

NAME
DBI - Database independent interface for Perl

SYNOPSIS
use DBI;

@driver_names = DBI->available_drivers;
%drivers = DBI->installed_drivers;
@data_sources = DBI->data_sources($driver_name, \%attr);

$dbh = DBI->connect($data_source, $username, $auth, \%attr);

$rv = $dbh->do($statement);
$rv = $dbh->do($statement, \%attr);
$rv = $dbh->do($statement, \%attr, @bind_values);

$ary_ref = $dbh->selectall_arrayref($statement);
$hash_ref = $dbh->selectall_hashref($statement, $key_field);

$ary_ref = $dbh->selectcol_arrayref($statement);
$ary_ref = $dbh->selectcol_arrayref($statement, \%attr);

測試使用的腳本:
[root@croracle03 DBI-1.609]# cat perl-module2.pl
#!/usr/bin/perl
use ExtUtils::Installed;

my $inst = ExtUtils::Installed->new();
print join "\n",$inst->modules();
[root@croracle03 DBI-1.609]#



下載并安裝 Perl DBD-mysql tar包
Perl DBD-mysql
http://www.cpan.org/modules/by-module/DBD/DBD-mysql-4.012.tar.gz
[root@croracle03 software]# wget http://www.cpan.org/modules/by-module/DBD/DBD-mysql-4.012.tar.gz
--15:22:18-- http://www.cpan.org/modules/by-module/DBD/DBD-mysql-4.012.tar.gz
Resolving www.cpan.org... 66.39.76.93
Connecting to www.cpan.org|66.39.76.93|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 129160 (126K) [application/x-tar]
Saving to: `DBD-mysql-4.012.tar.gz'

100%[=======================================>] 129,160 60.3K/s in 2.1s

15:22:21 (60.3 KB/s) - `DBD-mysql-4.012.tar.gz' saved [129160/129160]
安裝
[root@croracle03 software]# tar xvfz DBD-mysql-4.012.tar.gz
DBD-mysql-4.012/
DBD-mysql-4.012/ChangeLog
DBD-mysql-4.012/constants.h
DBD-mysql-4.012/dbdimp.c
DBD-mysql-4.012/dbdimp.h
DBD-mysql-4.012/eg/
DBD-mysql-4.012/eg/._bug14979.pl
DBD-mysql-4.012/eg/bug14979.pl
DBD-mysql-4.012/eg/._bug21028.pl
DBD-mysql-4.012/eg/bug21028.pl
DBD-mysql-4.012/eg/bug30033.pl
DBD-mysql-4.012/eg/bug30033pg.pl
DBD-mysql-4.012/eg/decimal_test.pl
DBD-mysql-4.012/eg/issue21946.pl
DBD-mysql-4.012/eg/prepare_memory_usage.pl
DBD-mysql-4.012/eg/proc_example1.pl
DBD-mysql-4.012/eg/proc_example2.pl
DBD-mysql-4.012/eg/proc_example2a.pl
DBD-mysql-4.012/eg/proc_example2b.pl
DBD-mysql-4.012/eg/proc_example3.pl
DBD-mysql-4.012/eg/proc_example4.pl
DBD-mysql-4.012/INSTALL.html
DBD-mysql-4.012/lib/
DBD-mysql-4.012/lib/Bundle/
DBD-mysql-4.012/lib/Bundle/DBD/
DBD-mysql-4.012/lib/Bundle/DBD/mysql.pm
DBD-mysql-4.012/lib/DBD/
DBD-mysql-4.012/lib/DBD/mysql/
DBD-mysql-4.012/lib/DBD/mysql/GetInfo.pm
DBD-mysql-4.012/lib/DBD/mysql/INSTALL.pod
DBD-mysql-4.012/lib/DBD/mysql.pm
DBD-mysql-4.012/Makefile.PL
DBD-mysql-4.012/Makefile.PL.embedded
DBD-mysql-4.012/MANIFEST
DBD-mysql-4.012/MANIFEST.SKIP
DBD-mysql-4.012/META.yml
DBD-mysql-4.012/myld
DBD-mysql-4.012/mysql.xs
DBD-mysql-4.012/README
DBD-mysql-4.012/t/
DBD-mysql-4.012/t/00base.t
DBD-mysql-4.012/t/10connect.t
DBD-mysql-4.012/t/20createdrop.t
DBD-mysql-4.012/t/25lockunlock.t
DBD-mysql-4.012/t/29warnings.t
DBD-mysql-4.012/t/30insertfetch.t
DBD-mysql-4.012/t/31insertid.t
DBD-mysql-4.012/t/32insert_error.t
DBD-mysql-4.012/t/35limit.t
DBD-mysql-4.012/t/35prepare.t
DBD-mysql-4.012/t/40bindparam.t
DBD-mysql-4.012/t/40bindparam2.t
DBD-mysql-4.012/t/40blobs.t
DBD-mysql-4.012/t/40catalog.t
DBD-mysql-4.012/t/40keyinfo.t
DBD-mysql-4.012/t/40listfields.t
DBD-mysql-4.012/t/40nulls.t
DBD-mysql-4.012/t/40numrows.t
DBD-mysql-4.012/t/40server_prepare.t
DBD-mysql-4.012/t/40server_prepare_error.t
DBD-mysql-4.012/t/40types.t
DBD-mysql-4.012/t/41bindparam.t
DBD-mysql-4.012/t/41blobs_prepare.t
DBD-mysql-4.012/t/42bindparam.t
DBD-mysql-4.012/t/50chopblanks.t
DBD-mysql-4.012/t/50commit.t
DBD-mysql-4.012/t/51bind_type_guessing.t
DBD-mysql-4.012/t/55utf8.t
DBD-mysql-4.012/t/60leaks.t
DBD-mysql-4.012/t/65types.t
DBD-mysql-4.012/t/70takeimp.t
DBD-mysql-4.012/t/71impdata.t
DBD-mysql-4.012/t/75supported_sql.t
DBD-mysql-4.012/t/76multi_statement.t
DBD-mysql-4.012/t/80procs.t
DBD-mysql-4.012/t/lib.pl
DBD-mysql-4.012/t/mysql.dbtest
DBD-mysql-4.012/t/mysql.mtest
DBD-mysql-4.012/TODO
[root@croracle03 software]#

運行命令,報錯
[root@croracle03 DBD-mysql-4.012]# perl Makefile.PL
Can't exec "mysql_config": No such file or directory at Makefile.PL line 82.

Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located


PLEASE NOTE:

For 'make test' to run properly, you must ensure that the
database user 'root' can connect to your MySQL server
and has the proper privileges that these tests require such
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others.

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';

You can also optionally set the user to run 'make test' with:

perl Makefile.pl --testuser=username

Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 464.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Failed to determine directory of mysql.h. Use

perl Makefile.PL --cflags=-I

to set this directory. For details see the INSTALL.html file,
section "C Compiler flags" or type

perl Makefile.PL --help
[root@croracle03 DBD-mysql-4.012]#

問題原因是沒有找到mysql的開發包,下載之

[root@croracle03 software]# rpm -ivh MySQL-devel-community-5.1.36-0.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-devel-community ########################################### [100%]
[root@croracle03 software]#


再次安裝 DBD-mysql包
[root@croracle03 software]# cd DBD-mysql-4.012
[root@croracle03 DBD-mysql-4.012]# perl Makefile.PL


PLEASE NOTE:

For 'make test' to run properly, you must ensure that the
database user 'root' can connect to your MySQL server
and has the proper privileges that these tests require such
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others.

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';

You can also optionally set the user to run 'make test' with:

perl Makefile.pl --testuser=username

I will use the following settings for compiling and testing:

cflags (mysql_config) = -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -DUNIV_LINUX
embedded (mysql_config) =
libs (mysql_config) = -rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lmygcc
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testsocket (default ) =
testuser (guessed ) = root

To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.

Checking if your kit is complete...
Looks good
Unrecognized argument in LIBS ignored: '-rdynamic'
Using DBI 1.609 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::mysql
[root@croracle03 DBD-mysql-4.012]#


[root@croracle03 DBD-mysql-4.012]# make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base....................ok
t/10connect.................ok
t/20createdrop..............ok
t/25lockunlock..............ok
t/29warnings................ok
t/30insertfetch.............ok
t/31insertid................ok
t/32insert_error............ok
t/35limit...................ok
t/35prepare.................ok
t/40bindparam...............ok
t/40bindparam2..............ok
t/40blobs...................ok
t/40catalog.................ok
t/40keyinfo.................ok
t/40listfields..............ok
t/40nulls...................ok
t/40numrows.................ok
t/40server_prepare..........ok
t/40server_prepare_error....ok
t/40types...................ok
t/41bindparam...............ok
t/41blobs_prepare...........ok
t/42bindparam...............ok
t/50chopblanks..............ok
t/50commit..................ok
t/51bind_type_guessing......ok
t/55utf8....................ok
t/60leaks...................skipped
all skipped: Skip $ENV{SLOW_TESTS} is not set
t/65types...................ok
t/70takeimp.................ok
t/71impdata.................ok
t/75supported_sql...........ok
t/76multi_statement.........ok
t/80procs...................ok
All tests successful, 1 test skipped.
Files=35, Tests=740, 5 wallclock secs ( 2.74 cusr + 1.04 csys = 3.78 CPU)
[root@croracle03 DBD-mysql-4.012]#

[root@croracle03 DBD-mysql-4.012]# make install
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.bs
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Bundle/DBD/mysql.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql/INSTALL.pod
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql/GetInfo.pm
Installing /usr/share/man/man3/DBD::mysql::INSTALL.3pm
Installing /usr/share/man/man3/DBD::mysql.3pm
Installing /usr/share/man/man3/Bundle::DBD::mysql.3pm
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
[root@croracle03 DBD-mysql-4.012]#


檢查包是否安裝成功:

[root@croracle03 DBI-1.609]# ./perl-module.pl
DBD::mysql
DBI
Perl[root@croracle03 DBI-1.609]#



下載安裝 XML-Parser-2.36 包

[root@croracle03 software]# wget -c http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/XML-Parser-2.36.tar.gz
--15:43:22-- http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/XML-Parser-2.36.tar.gz
Resolving search.cpan.org... 207.115.101.144, 64.235.248.44
Connecting to search.cpan.org|207.115.101.144|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/authors/id/M/MS/MSERGEANT/XML-Parser-2.36.tar.gz [following]
--15:43:23-- http://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/authors/id/M/MS/MSERGEANT/XML-Parser-2.36.tar.gz
Resolving ftp.cuhk.edu.hk... 137.189.4.14
Connecting to ftp.cuhk.edu.hk|137.189.4.14|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 230002 (225K) [application/x-gzip]
--15:43:25-- (try: 2) http://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/authors/id/M/MS/MSERGEANT/XML-Parser-2.36.tar.gz
Reusing existing connection to ftp.cuhk.edu.hk:80.
HTTP request sent, awaiting response... 200 OK
Length: 230002 (225K) [application/x-gzip]
Saving to: `XML-Parser-2.36.tar.gz'

100%[=======================================>] 230,002 266K/s in 0.8s

15:43:26 (266 KB/s) - `XML-Parser-2.36.tar.gz' saved [230002/230002]

[root@croracle03 software]# tar xvfz XML-Parser-2.36.tar.gz
XML-Parser-2.36/
XML-Parser-2.36/Changes
XML-Parser-2.36/Expat/
XML-Parser-2.36/Expat/encoding.h
XML-Parser-2.36/Expat/Expat.pm
XML-Parser-2.36/Expat/Expat.xs
XML-Parser-2.36/Expat/Makefile.PL
XML-Parser-2.36/Expat/typemap
XML-Parser-2.36/Makefile.PL
XML-Parser-2.36/MANIFEST
XML-Parser-2.36/META.yml
XML-Parser-2.36/Parser/
XML-Parser-2.36/Parser/Encodings/
XML-Parser-2.36/Parser/Encodings/big5.enc
XML-Parser-2.36/Parser/Encodings/euc-kr.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-2.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-3.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-4.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-5.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-7.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-8.enc
XML-Parser-2.36/Parser/Encodings/iso-8859-9.enc
XML-Parser-2.36/Parser/Encodings/Japanese_Encodings.msg
XML-Parser-2.36/Parser/Encodings/README
XML-Parser-2.36/Parser/Encodings/windows-1250.enc
XML-Parser-2.36/Parser/Encodings/windows-1252.enc
XML-Parser-2.36/Parser/Encodings/x-euc-jp-jisx0221.enc
XML-Parser-2.36/Parser/Encodings/x-euc-jp-unicode.enc
XML-Parser-2.36/Parser/Encodings/x-sjis-cp932.enc
XML-Parser-2.36/Parser/Encodings/x-sjis-jdk117.enc
XML-Parser-2.36/Parser/Encodings/x-sjis-jisx0221.enc
XML-Parser-2.36/Parser/Encodings/x-sjis-unicode.enc
XML-Parser-2.36/Parser/LWPExternEnt.pl
XML-Parser-2.36/Parser/Style/
XML-Parser-2.36/Parser/Style/Debug.pm
XML-Parser-2.36/Parser/Style/Objects.pm
XML-Parser-2.36/Parser/Style/Stream.pm
XML-Parser-2.36/Parser/Style/Subs.pm
XML-Parser-2.36/Parser/Style/Tree.pm
XML-Parser-2.36/Parser.pm
XML-Parser-2.36/README
XML-Parser-2.36/samples/
XML-Parser-2.36/samples/canonical
XML-Parser-2.36/samples/canontst.xml
XML-Parser-2.36/samples/ctest.dtd
XML-Parser-2.36/samples/REC-xml-19980210.xml
XML-Parser-2.36/samples/xmlcomments
XML-Parser-2.36/samples/xmlfilter
XML-Parser-2.36/samples/xmlstats
XML-Parser-2.36/t/
XML-Parser-2.36/t/astress.t
XML-Parser-2.36/t/cdata.t
XML-Parser-2.36/t/decl.t
XML-Parser-2.36/t/defaulted.t
XML-Parser-2.36/t/encoding.t
XML-Parser-2.36/t/ext.ent
XML-Parser-2.36/t/ext2.ent
XML-Parser-2.36/t/external_ent.t
XML-Parser-2.36/t/file.t
XML-Parser-2.36/t/finish.t
XML-Parser-2.36/t/foo.dtd
XML-Parser-2.36/t/namespaces.t
XML-Parser-2.36/t/parament.t
XML-Parser-2.36/t/partial.t
XML-Parser-2.36/t/skip.t
XML-Parser-2.36/t/stream.t
XML-Parser-2.36/t/styles.t
[root@croracle03 software]#

[root@croracle03 XML-Parser-2.36]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for XML::Parser::Expat
Writing Makefile for XML::Parser
[root@croracle03 XML-Parser-2.36]#



[root@croracle03 XML-Parser-2.36]# make
cp Parser/Encodings/x-sjis-cp932.enc blib/lib/XML/Parser/Encodings/x-sjis-cp932.enc
cp Parser/Encodings/iso-8859-7.enc blib/lib/XML/Parser/Encodings/iso-8859-7.enc
cp Parser/Style/Tree.pm blib/lib/XML/Parser/Style/Tree.pm
cp Parser/Encodings/iso-8859-9.enc blib/lib/XML/Parser/Encodings/iso-8859-9.enc
cp Parser/Encodings/x-euc-jp-unicode.enc blib/lib/XML/Parser/Encodings/x-euc-jp-unicode.enc
cp Parser/Encodings/README blib/lib/XML/Parser/Encodings/README
cp Parser/Encodings/euc-kr.enc blib/lib/XML/Parser/Encodings/euc-kr.enc
cp Parser/Encodings/windows-1250.enc blib/lib/XML/Parser/Encodings/windows-1250.enc
cp Parser/Encodings/windows-1252.enc blib/lib/XML/Parser/Encodings/windows-1252.enc
cp Parser/Encodings/big5.enc blib/lib/XML/Parser/Encodings/big5.enc
cp Parser/Encodings/Japanese_Encodings.msg blib/lib/XML/Parser/Encodings/Japanese_Encodings.msg
cp Parser/Encodings/iso-8859-3.enc blib/lib/XML/Parser/Encodings/iso-8859-3.enc
cp Parser/Style/Subs.pm blib/lib/XML/Parser/Style/Subs.pm
cp Parser/Encodings/x-euc-jp-jisx0221.enc blib/lib/XML/Parser/Encodings/x-euc-jp-jisx0221.enc
cp Parser/Encodings/iso-8859-8.enc blib/lib/XML/Parser/Encodings/iso-8859-8.enc
cp Parser/Encodings/iso-8859-4.enc blib/lib/XML/Parser/Encodings/iso-8859-4.enc
cp Parser/Encodings/x-sjis-jdk117.enc blib/lib/XML/Parser/Encodings/x-sjis-jdk117.enc
cp Parser/Encodings/iso-8859-2.enc blib/lib/XML/Parser/Encodings/iso-8859-2.enc
cp Parser/Encodings/x-sjis-unicode.enc blib/lib/XML/Parser/Encodings/x-sjis-unicode.enc
cp Parser/LWPExternEnt.pl blib/lib/XML/Parser/LWPExternEnt.pl
cp Parser/Style/Objects.pm blib/lib/XML/Parser/Style/Objects.pm
cp Parser.pm blib/lib/XML/Parser.pm
cp Parser/Style/Debug.pm blib/lib/XML/Parser/Style/Debug.pm
cp Parser/Encodings/x-sjis-jisx0221.enc blib/lib/XML/Parser/Encodings/x-sjis-jisx0221.enc
cp Parser/Style/Stream.pm blib/lib/XML/Parser/Style/Stream.pm
cp Parser/Encodings/iso-8859-5.enc blib/lib/XML/Parser/Encodings/iso-8859-5.enc
make[1]: Entering directory `/root/software/XML-Parser-2.36/Expat'
cp Expat.pm ../blib/lib/XML/Parser/Expat.pm
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -noprototypes -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap -typemap typemap Expat.xs > Expat.xsc && mv Expat.xsc Expat.c
gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"2.36\" -DXS_VERSION=\"2.36\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" Expat.c
Expat.xs: In function ‘generate_model’:
Expat.xs:260: warning: enumeration value ‘XML_CTYPE_EMPTY’ not handled in switch
Expat.xs:260: warning: enumeration value ‘XML_CTYPE_ANY’ not handled in switch
Expat.xs: In function ‘parse_stream’:
Expat.xs:299: warning: unused variable ‘buff’
Expat.xs: In function ‘startElement’:
Expat.xs:501: warning: comparison is always false due to limited range of data type
Expat.xs:485: warning: unused variable ‘pnslst’
Expat.xs:484: warning: unused variable ‘pnstab’
Expat.xs:481: warning: unused variable ‘pcontext’
Expat.xs: In function ‘externalEntityRef’:
Expat.xs:1028: warning: value computed is not used
Expat.xs: In function ‘unknownEncoding’:
Expat.xs:1146: warning: unused variable ‘count’
Expat.xs: In function ‘XS_XML__Parser__Expat_ParseStream’:
Expat.xs:1462: warning: unused variable ‘delimsv’
Expat.xs: In function ‘XS_XML__Parser__Expat_ParsePartial’:
Expat.xs:1488: warning: unused variable ‘cbv’
Expat.xs: In function ‘XS_XML__Parser__Expat_SetDoctypeHandler’:
Expat.xs:1740: warning: unused variable ‘set’
Expat.c: In function ‘XS_XML__Parser__Expat_GetBase’:
Expat.c:2080: warning: unused variable ‘RETVAL’
Expat.xs: In function ‘XS_XML__Parser__Expat_DefaultCurrent’:
Expat.xs:1920: warning: unused variable ‘cbv’
Expat.c: In function ‘XS_XML__Parser__Expat_ErrorString’:
Expat.c:2378: warning: unused variable ‘targ’
Expat.c:2377: warning: unused variable ‘RETVAL’
Expat.xs: In function ‘XS_XML__Parser__Expat_LoadEncoding’:
Expat.xs:2043: warning: comparison is always false due to limited range of data type
Expat.xs:2044: warning: comparison is always false due to limited range of data type
Expat.xs: In function ‘XS_XML__Parser__Expat_Do_External_Parse’:
Expat.xs:2205: warning: unused variable ‘pret’
Expat.xs:2194: warning: unused variable ‘cbv’
Expat.xs:2192: warning: unused variable ‘type’
Expat.c: At top level:
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/patchlevel.h:122: warning: ‘local_patches’ defined but not used
Expat.xs: In function ‘parse_stream’:
Expat.xs:291: warning: ‘linebuff’ may be used uninitialized in this function
Expat.xs:289: warning: ‘tbuff’ may be used uninitialized in this function
Expat.xs:290: warning: ‘tsiz’ may be used uninitialized in this function
Expat.c: In function ‘XS_XML__Parser__Expat_Do_External_Parse’:
Expat.c:2689: warning: ‘RETVAL’ may be used uninitialized in this function
Running Mkbootstrap for XML::Parser::Expat ()
chmod 644 Expat.bs
rm -f ../blib/arch/auto/XML/Parser/Expat/Expat.so
gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic Expat.o -o ../blib/arch/auto/XML/Parser/Expat/Expat.so \
-lexpat \

chmod 755 ../blib/arch/auto/XML/Parser/Expat/Expat.so
cp Expat.bs ../blib/arch/auto/XML/Parser/Expat/Expat.bs
chmod 644 ../blib/arch/auto/XML/Parser/Expat/Expat.bs
Manifying ../blib/man3/XML::Parser::Expat.3pm
make[1]: Leaving directory `/root/software/XML-Parser-2.36/Expat'
Manifying blib/man3/XML::Parser::Style::Objects.3pm
Manifying blib/man3/XML::Parser::Style::Debug.3pm
Manifying blib/man3/XML::Parser.3pm
Manifying blib/man3/XML::Parser::Style::Subs.3pm
Manifying blib/man3/XML::Parser::Style::Tree.3pm
Manifying blib/man3/XML::Parser::Style::Stream.3pm

[root@croracle03 XML-Parser-2.36]# make test
make[1]: Entering directory `/root/software/XML-Parser-2.36/Expat'
make[1]: Leaving directory `/root/software/XML-Parser-2.36/Expat'
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/astress.........ok
t/cdata...........ok
t/decl............ok
t/defaulted.......ok
t/encoding........ok
t/external_ent....ok
t/file............ok
t/finish..........ok
t/namespaces......ok
t/parament........ok
t/partial.........ok
t/skip............ok
t/stream..........ok
t/styles..........ok
All tests successful.
Files=14, Tests=130, 2 wallclock secs ( 0.78 cusr + 0.48 csys = 1.26 CPU)
[root@croracle03 XML-Parser-2.36]#


[root@croracle03 XML-Parser-2.36]# make install
make[1]: Entering directory `/root/software/XML-Parser-2.36/Expat'
make[1]: Leaving directory `/root/software/XML-Parser-2.36/Expat'
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/XML/Parser/Expat/Expat.bs
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/XML/Parser/Expat/Expat.so
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Expat.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/LWPExternEnt.pl
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/x-sjis-jisx0221.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/x-euc-jp-jisx0221.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/x-sjis-cp932.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/x-euc-jp-unicode.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/iso-8859-8.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/Japanese_Encodings.msg
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/iso-8859-2.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/big5.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/iso-8859-5.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/iso-8859-3.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/euc-kr.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/README
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/iso-8859-4.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/x-sjis-unicode.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/x-sjis-jdk117.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/windows-1250.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/windows-1252.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/iso-8859-9.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Encodings/iso-8859-7.enc
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Style/Objects.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Style/Stream.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Style/Tree.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Style/Subs.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/Style/Debug.pm
Installing /usr/share/man/man3/XML::Parser::Style::Subs.3pm
Installing /usr/share/man/man3/XML::Parser::Style::Stream.3pm
Installing /usr/share/man/man3/XML::Parser::Style::Tree.3pm
Installing /usr/share/man/man3/XML::Parser.3pm
Installing /usr/share/man/man3/XML::Parser::Style::Objects.3pm
Installing /usr/share/man/man3/XML::Parser::Style::Debug.3pm
Installing /usr/share/man/man3/XML::Parser::Expat.3pm
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/XML/Parser/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
[root@croracle03 XML-Parser-2.36]#


檢查是否安裝成功:
[root@croracle03 DBI-1.609]# ./perl-module.pl
DBD::mysql
DBI
Perl
XML::Parser[root@croracle03 DBI-1.609]#


Install Zrm for Mysql
安裝Zrm

[root@croracle03 software]# rpm -ivh MySQL-zrm-2.1-1.noarch.rpm
warning: MySQL-zrm-2.1-1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 3c5d1c92
error: Failed dependencies:
perl(XML::Parser) is needed by MySQL-zrm-2.1-1.noarch
perl-DBI is needed by MySQL-zrm-2.1-1.noarch
[root@croracle03 software]#



[root@croracle03 software]# rpm -ivh MySQL-zrm-2.1-1.noarch.rpm --nodeps
warning: MySQL-zrm-2.1-1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 3c5d1c92
Preparing... ########################################### [100%]
1:MySQL-zrm ########################################### [100%]
Checking and Migrating old ZRM data
[root@croracle03 software]#



Verify Zrm for Mysql Installation
檢查包是否安裝成功
[root@croracle03 software]# ls -lh /usr/bin/mysql-zrm*
-rwxr-x--- 1 mysql mysql 3.1K Dec 5 2008 /usr/bin/mysql-zrm
-rwxr-x--- 1 mysql mysql 1.7K Dec 5 2008 /usr/bin/mysql-zrm-abort-backup
-rwxr-x--- 1 mysql mysql 57K Dec 5 2008 /usr/bin/mysql-zrm-backup
-rwxr-x--- 1 mysql mysql 1.6K Dec 5 2008 /usr/bin/mysql-zrm-check
-rwxr-x--- 1 mysql mysql 2.8K Dec 5 2008 /usr/bin/mysql-zrm-extract-backup
-rwxr-x--- 1 mysql mysql 1.8K Dec 5 2008 /usr/bin/mysql-zrm-getconf
-rwxr-x--- 1 mysql mysql 4.4K Dec 5 2008 /usr/bin/mysql-zrm-list
-rwxr-x--- 1 mysql mysql 11K Dec 5 2008 /usr/bin/mysql-zrm-manage-backup
-rwxr-x--- 1 mysql mysql 2.7K Dec 5 2008 /usr/bin/mysql-zrm-migrate-file-ownership
-rwxr-x--- 1 mysql mysql 7.1K Dec 5 2008 /usr/bin/mysql-zrm-parse-binlogs
-rwxr-x--- 1 mysql mysql 4.7K Dec 5 2008 /usr/bin/mysql-zrm-purge
-rwxr-x--- 1 mysql mysql 27K Dec 5 2008 /usr/bin/mysql-zrm-reporter
-rwxr-x--- 1 mysql mysql 20K Dec 5 2008 /usr/bin/mysql-zrm-restore
-rwxr-x--- 1 mysql mysql 13K Dec 5 2008 /usr/bin/mysql-zrm-scheduler
-rwxr-x--- 1 mysql mysql 8.0K Dec 5 2008 /usr/bin/mysql-zrm-verify-backup
[root@croracle03 software]#



檢查配置文件是否安裝成功
ZRM for Mysql configuration files are located in /etc/mysql-zrm:

[root@croracle03 software]# ls -lh /etc/mysql-zrm/
total 24K
-rwxrwx--- 1 mysql mysql 11K Dec 5 2008 mysql-zrm.conf
-rwxrwx--- 1 mysql mysql 46 Dec 5 2008 mysql-zrm-release
-rwxrwx--- 1 mysql mysql 3.1K Dec 5 2008 mysql-zrm-reporter.conf
-rw-rw---- 1 mysql mysql 596 Dec 5 2008 RSS.header
[root@croracle03 software]#



configure ZRM for Mysql to backup your database
配置ZRM

用之前建立的備份用戶登錄
[root@croracle03 software]# mysql -u backup-user -ppass123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 67
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

創建一個測試庫,并導入數據
mysql> create database zrmtest;
Query OK, 1 row affected (0.01 sec)

mysql>


mysql> use zrmtest;
Database changed
mysql> CREATE TABLE ORDERLINES
-> (
-> ORDERLINEID SMALLINT NOT NULL,
-> ORDERID INT NOT NULL,
-> PROD_ID INT NOT NULL,
-> QUANTITY SMALLINT NOT NULL,
-> ORDERDATE DATE NOT NULL
-> )
-> ;
Query OK, 0 rows affected (0.00 sec)

mysql>



1. log in as root on your linux server.
2. configure a daily full backup of the zrmtest database.
使用root權限用戶登錄
配置一個每天的全備份

[root@croracle03 software]# cd /etc/mysql-zrm/
[root@croracle03 mysql-zrm]# ls
mysql-zrm.conf mysql-zrm-release mysql-zrm-reporter.conf RSS.header
創建一個目錄存放每日全備份腳本
[root@croracle03 mysql-zrm]# mkdir dailyrun
[root@croracle03 mysql-zrm]# cp mysql-zrm.conf dailyrun/
[root@croracle03 mysql-zrm]# cd dailyrun/
[root@croracle03 dailyrun]# ls -lh
total 12K
-rwxr-x--- 1 root root 11K Aug 7 16:08 mysql-zrm.conf
[root@croracle03 dailyrun]#

編輯腳本:
Edit /etc/mysql-zrm/dailyrun/mysql-zrm.conf to change the parameters as
shown below.


# Backup level. It can be full or incremental
# Use 0 for full and 1 for incremental backups
# This parameter is optional and default value is full backup.
#
backup-level=0 #備份level設定為0


retention-policy=10D #保存期限為10day
backup-mode=logical # 備份模式為logical
databases="zrmtest" #要備份的庫名
compress=1 #壓縮級別
user="backup-user" # 備份用戶(Mysql)
verbose=1 #描述級別

mailto="aaa@bbb.ccc" #通知信箱設定


命令行設定:
[root@croracle03 dailyrun]# mysql-zrm-backup --backup-set dailyrun
backup:INFO: ZRM for MySQL Community Edition - version 2.1
dailyrun:backup:INFO: START OF BACKUP
dailyrun:backup:INFO: PHASE START: Initialization
dailyrun:backup:INFO: The quick backup-type is supported only for snapshot backups. Setting backup-type to 'regular'
dailyrun:backup:INFO: Mail address: ivanyao@cri.com.hk is ok
dailyrun:backup:INFO: ZRM Temporary configuration file = /etc/mysql-zrm/dailyrun/tmpKvU2v.conf
dailyrun:backup:INFO: {
dailyrun:backup:INFO: verbose=1
dailyrun:backup:INFO: retention-policy=10D
dailyrun:backup:INFO: backup-level=0
dailyrun:backup:INFO: mailto=ivanyao@cri.com.hk
dailyrun:backup:INFO: databases=zrmtest
dailyrun:backup:INFO: backup-mode=logical
dailyrun:backup:INFO: password=******
dailyrun:backup:INFO: backup-type=regular
dailyrun:backup:INFO: compress=
dailyrun:backup:INFO: user=backup-user
dailyrun:backup:INFO: }
dailyrun:backup:INFO: Getting mysql variables
dailyrun:backup:INFO: mysqladmin --user="backup-user" --password="*****" variables
dailyrun:backup:INFO: datadir is /var/lib/mysql/
dailyrun:backup:INFO: mysql_version is 5.1.36-community-log
dailyrun:backup:INFO: InnoDB data file are /var/lib/mysql/ibdata1
dailyrun:backup:INFO: InnoDB log dir is /var/lib/mysql/.
dailyrun:backup:INFO: backup set being used is dailyrun
dailyrun:backup:INFO: backup-set=dailyrun
dailyrun:backup:INFO: backup-date=20090807162212
dailyrun:backup:INFO: mysql-server-os=Linux/Unix
dailyrun:backup:INFO: backup-type=regular
dailyrun:backup:INFO: host=localhost
dailyrun:backup:INFO: backup-date-epoch=1249633332
dailyrun:backup:INFO: retention-policy=10D
dailyrun:backup:INFO: mysql-zrm-version=ZRM for MySQL Community Edition - version 2.1
dailyrun:backup:INFO: mysql-version=5.1.36-community-log
dailyrun:backup:INFO: backup-directory=/var/lib/mysql-zrm/dailyrun/20090807162212
dailyrun:backup:INFO: backup-level=0
dailyrun:backup:INFO: backup-mode=logical
dailyrun:backup:INFO: PHASE END: Initialization
dailyrun:backup:INFO: PHASE START: Running pre backup plugin
dailyrun:backup:INFO: Executing pre-backup-plugin
dailyrun:backup:INFO: PHASE END: Running pre backup plugin
dailyrun:backup:INFO: PHASE START: Flushing logs
dailyrun:backup:INFO: Flushing the logs
dailyrun:backup:INFO: mysqladmin --user="backup-user" --password="*****" flush-logs
dailyrun:backup:INFO: Getting master logname using command mysql --user="backup-user" --password="*****" -e "show master status"
dailyrun:backup:INFO: PHASE END: Flushing logs
dailyrun:backup:INFO: PHASE START: Creating logical backup
dailyrun:backup:INFO: Command used for logical backup is mysqldump --opt --extended-insert --create-options --default-character-set=utf8 --single-transaction --user="backup-user" --password="*****" --databases zrmtest > "/var/lib/mysql-zrm/dailyrun/20090807162212/backup.sql"
dailyrun:backup:INFO: Logical backup done for the following database(s)
zrmtest
dailyrun:backup:INFO: logical-databases=zrmtest
dailyrun:backup:INFO: PHASE END: Creating logical backup
dailyrun:backup:INFO: PHASE START: Calculating backup size & checksums
dailyrun:backup:INFO: next-binlog=mysql-bin.000008
dailyrun:backup:INFO: backup-size=1.67 MB
dailyrun:backup:INFO: PHASE END: Calculating backup size & checksums
dailyrun:backup:INFO: PHASE START: Compression/Encryption
dailyrun:backup:INFO: Compressing backup
dailyrun:backup:INFO: Command used is 'tar --same-owner -cpsC "/var/lib/mysql-zrm/dailyrun/20090807162212" --exclude=backup-data --exclude=index --exclude=zrm_checksum --exclude=backup-sql . 2>/tmp/sAqQmLDtKe | gzip 2>/tmp/54RCr7d03A > "/var/lib/mysql-zrm/dailyrun/20090807162212/backup-data" 2>/tmp/PnD4Np8EAU'
dailyrun:backup:INFO: compress=
dailyrun:backup:INFO: backup-size-compressed=0.39 MB
dailyrun:backup:INFO: Removing all of the uncompressed/unencrypted data
dailyrun:backup:INFO: PHASE END: Compression/Encryption
dailyrun:backup:INFO: read-locks-time=00:00:01
dailyrun:backup:INFO: flush-logs-time=00:00:00
dailyrun:backup:INFO: compress-encrypt-time=00:00:01
dailyrun:backup:INFO: backup-time=00:00:01
dailyrun:backup:INFO: backup-status=Backup succeeded
dailyrun:backup:INFO: Backup succeeded
dailyrun:backup:INFO: PHASE START: Running post backup plugin
dailyrun:backup:INFO: Executing post-backup-plugin
dailyrun:backup:INFO: PHASE END: Running post backup plugin
dailyrun:backup:INFO: PHASE START: Mailing backup report
dailyrun:backup:INFO: mailing file /tmp/HECjXsbWwG
dailyrun:backup:INFO: mail command is cat "/tmp/HECjXsbWwG"|mail -s "[ZRM for MySQL Report] backup-set dailyrun" ivanyao@cri.com.hk
dailyrun:backup:INFO: PHASE END: Mailing backup report
dailyrun:backup:INFO: PHASE START: Cleanup
dailyrun:backup:INFO: PHASE END: Cleanup
dailyrun:backup:INFO: END OF BACKUP
You have new mail in /var/spool/mail/root
[root@croracle03 dailyrun]#


備份計畫設定:
mysql-zrm-scheduler --add --interval daily --start 01:00 --backup-level 0 --backup-set dailyrun


[root@croracle03 dailyrun]# mysql-zrm-scheduler --add --interval daily --start 01:00 --backup-level 0 --backup-set dailyrun
schedule:INFO: ZRM for MySQL Community Edition - version 2.1
Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log
DONE
[root@croracle03 dailyrun]#


備份計畫查詢
[root@croracle03 dailyrun]# mysql-zrm-scheduler --query
schedule:INFO: ZRM for MySQL Community Edition - version 2.1
Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log
0 1 * * * /usr/bin/zrm-pre-scheduler --action backup --backup-set dailyrun --backup-level 0 --interval daily
[root@croracle03 dailyrun]#


備份集查詢:
[root@croracle03 dailyrun]# mysql-zrm-reporter --where backup-set=dailyrun --show backup-status-info
reporter:WARNING: Backup root directory not specified, Assigning default value as /var/lib/mysql-zrm

REPORT TYPE : backup-status-info

backup_set backup_date backup_level backup_status backup_type comment
-----------------------------------------------------------------------------------------------------------------------------
dailyrun Fri 07 Aug 2009 04:22:12 0 Backup succeeded regular ----
PM HKT
[root@croracle03 dailyrun]#


備份報告:
[root@croracle03 dailyrun]# mysql-zrm-reporter --where backup-set=dailyrun --show backup-performance-info
reporter:WARNING: Backup root directory not specified, Assigning default value as /var/lib/mysql-zrm

REPORT TYPE : backup-performance-info

backup_set backup_date backup_level backup_size backup_size_compressed backup_time backup_type compress_encrypt_time
----------------------------------------------------------------------------------------------------------------------------------------------------------------
dailyrun Fri 07 Aug 2009 04:22:12 0 1.67 MB 0.39 MB 00:00:01 regular 00:00:01
PM HKT
[root@croracle03 dailyrun]#



[root@croracle03 dailyrun]# mysql-zrm --action verify-backup --backup-set dailyrun
verify-backup:INFO: ZRM for MySQL Community Edition - version 2.1
dailyrun:verify-backup:INFO: Verification successful
[root@croracle03 dailyrun]#



Perform a full restoration


恢復實驗:

[root@croracle03 dailyrun]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 83
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| replDB |
| test |
| zrmtest |
+--------------------+
5 rows in set (0.00 sec)

將測試庫刪除
mysql> drop database zrmtest;
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| replDB |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql>



1Determine which backup to restore from.
查找備份集中可用的備份

[root@croracle03 dailyrun]# mysql-zrm-reporter --show restore-info --where backup-set=dailyrun
reporter:WARNING: Backup root directory not specified, Assigning default value as /var/lib/mysql-zrm

REPORT TYPE : restore-info

backup_set backup_date backup_level backup_directory backup_status comment
-----------------------------------------------------------------------------------------------------------------------------------------------------
dailyrun Fri 07 Aug 2009 04:22:12 0 /var/lib/mysql-zrm/dailyrun/20090807162212 Backup succeeded ----
PM HKT
[root@croracle03 dailyrun]#

mysql-zrm-restore --backup-set dailyrun --source-directory /var/lib/mysql-zrm/dailyrun/20090807162212

找到合適的備份集,恢復
[root@croracle03 dailyrun]# mysql-zrm-restore --backup-set dailyrun --source-directory /var/lib/mysql-zrm/dailyrun/20090807162212
restore:INFO: ZRM for MySQL Community Edition - version 2.1
dailyrun:restore:INFO: The quick backup-type is supported only for snapshot backups. Setting backup-type to 'regular'
dailyrun:restore:INFO: Mail address: ivanyao@cri.com.hk is ok
dailyrun:restore:INFO: ZRM Temporary configuration file = /etc/mysql-zrm/dailyrun/tmpOlsTl.conf
dailyrun:restore:INFO: {
dailyrun:restore:INFO: verbose=1
dailyrun:restore:INFO: retention-policy=10D
dailyrun:restore:INFO: backup-level=0
dailyrun:restore:INFO: mailto=ivanyao@cri.com.hk
dailyrun:restore:INFO: databases=zrmtest
dailyrun:restore:INFO: source-directory=/var/lib/mysql-zrm/dailyrun/20090807162212
dailyrun:restore:INFO: backup-mode=logical
dailyrun:restore:INFO: password=******
dailyrun:restore:INFO: backup-type=regular
dailyrun:restore:INFO: compress=
dailyrun:restore:INFO: user=backup-user
dailyrun:restore:INFO: }
dailyrun:restore:INFO: Getting mysql variables
dailyrun:restore:INFO: mysqladmin --user="backup-user" --password="*****" variables
dailyrun:restore:INFO: datadir is /var/lib/mysql/
dailyrun:restore:INFO: mysql_version is 5.1.36-community-log
dailyrun:restore:INFO: InnoDB data file are /var/lib/mysql/ibdata1
dailyrun:restore:INFO: InnoDB log dir is /var/lib/mysql/.
dailyrun:restore:INFO: Command used is 'cat "/var/lib/mysql-zrm/dailyrun/20090807162212/backup-data" | gzip -d | tar --same-owner -xpsC "/var/lib/mysql-zrm/dailyrun/20090807162212" 2>/tmp/t93A2oRNNR'
dailyrun:restore:INFO: restoring using command mysql --user="backup-user" --password="*****" -e "set character_set_client=utf8;set character_set_connection=utf8;set character_set_database=utf8;set character_set_results=utf8;set character_set_server=utf8;source /tmp/kWE08QcaGC;"
dailyrun:restore:INFO: Restored database(s) from logical backup: zrmtest
dailyrun:restore:INFO: Removing all of the uncompressed/unencrypted data
dailyrun:restore:INFO: Restore done in 1 seconds.
[root@croracle03 dailyrun]#


檢查數據庫恢復效果:
[root@croracle03 dailyrun]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 88
Server version: 5.1.36-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| replDB |
| test |
| zrmtest |
+--------------------+
5 rows in set (0.00 sec)

mysql> use zrmtest
Database changed
mysql> show tables;
+-------------------+
| Tables_in_zrmtest |
+-------------------+
| ORDERLINES |
+-------------------+
1 row in set (0.00 sec)

mysql> select count(*) from ORDERLINES;
+----------+
| count(*) |
+----------+
| 60350 |
+----------+
1 row in set (0.00 sec)

mysql>

Good luck!