本文共 4451 字,大约阅读时间需要 14 分钟。
一,首先安装两台相同版本操作系统的服务器
二,服务器配置文件信息
主机名和ip地址信息
/etc/hosts172.25.1.114 test01172.25.1.115 test02配置数据信任关系
/home/informix/.rhosts test01test02三,配置操作系统rsh服务
四,安装数据库
informix的实例名配置如下:ontest01 onsoctcp test01 6666 ontest02 onsoctcp test02 6666数据库配置文件中主要的配置如下:
为了实现通过管道备份恢复,配置TAPEDEV和LTAPEDEV的值STDIO
企业复制的参数暂时按照默认设置
# Data Replication Variables# DRAUTO: 0 manual, 1 retain type, 2 reverse typeDRAUTO 0 # DR automatic switchoverDRINTERVAL 30 # DR max time between DR buffer flushes (in sec)DRTIMEOUT 30 # DR network timeout (in sec)DRLOSTFOUND /home/informix/etc/dr.lostfound # DR lost+found file pathDRIDXAUTO 0 # DR automatic index repair. 0=off, 1=on 五,开始配置HDR为了测试方便,在test01上面建立一个数据库做为主,test02服务器上的数据库做为从。1,使用onmode -d 将test01的类型设置为主类型并指示相关联的辅助数据库服务器的名称(这个名称指的是从服务器的数据库的实例名)。
[informix@test01 informix]$ onmode -d primary ontest02
出现的日志信息为:
[informix@test01 informix]$ onstat -m14:51:55 DR: Reservation of the last logical log for log backup turned on
14:51:55 DR: new type = primary, secondary server name = ontest02 14:51:55 DR: Trying to connect to secondary server = ontest0214:51:55 DR: Cannot connect to secondary server14:51:55 DR: Turned off on primary server 2,在test01上执行备份通过管道直接在test02上面执行物理恢复[informix@test01 informix]$ ontape -s -L 0 -F | rsh test02 "ontape -p " 3,通过下面的日志信息可以看到test02上面的物理恢复已经完成[informix@test02 informix]$ onstat -mIBM Informix Dynamic Server Version 10.00.UC4 -- Fast Recovery -- Up 00:01:23 -- 229336 Kbytes
Message Log File: /home/informix/test02.log
14:54:02 DR: Reservation of the last logical log for log backup turned on
14:54:02 Data replication type and state information reset. To start DR, usethe 'onmode -d' command and wait for the pair to be operational,before shutting down the database server14:54:02 Dataskip is now OFF for all dbspaces
14:54:02 Restartable Restore has been ENABLED14:54:02 Recovery Mode14:54:04 Physical Restore of rootdbs started.14:54:05 Checkpoint Completed: duration was 0 seconds.
14:54:05 Checkpoint loguniq 4, logpos 0x17c018, timestamp: 0xed4a14:54:05 Maximum server connections 0
14:54:07 Physical Restore of rootdbs Completed.14:54:07 Checkpoint Completed: duration was 0 seconds.14:54:07 Checkpoint loguniq 4, logpos 0x17c018, timestamp: 0xed4e14:54:07 Maximum server connections 0
[informix@test02 informix]$
4,在test02上执行:[informix@test02 informix]$ onmode -d secondary ontest01系统提示:
[informix@test02 informix]$ onstat -m14:56:46 DR: Reservation of the last logical log for log backup turned off14:56:46 DR: new type = secondary, primary server name = ontest01 14:56:46 DR: Trying to connect to primary server = ontest0114:56:49 DR: Secondary server connected14:56:49 DR: Secondary server needs failure recovery5,此时数据库继续执行逻辑恢复,日志信息:
14:56:50 DR: Failure recovery from disk in progress ... 14:56:50 Logical Recovery Started.14:56:50 10 recovery worker threads will be started.14:56:50 Dynamically allocated new virtual shared memory segment (size 8192KB)14:56:50 Start Logical Recovery - Start Log 4, End Log ?14:56:50 Starting Log Position - 4 0x17c01814:56:50 Clearing the physical and logical logs has started14:56:51 Cleared 40 MB of the physical and logical logs in 0 seconds14:56:56 DR: Secondary server operational14:56:57 Checkpoint Completed: duration was 0 seconds.14:56:57 Checkpoint loguniq 5, logpos 0x1018, timestamp: 0xedaa14:56:57 Maximum server connections 0
而另外一台主服务器上面的日志信息为:14:56:49 DR: Primary server connected14:56:49 DR: Secondary server needs failure recovery14:56:52 Logical Log 4 Complete, timestamp: 0xed84.
14:56:53 DR: Sending log 4, size 1000 pages, 38.30 percent used14:56:53 DR: Sending log 5 (current), size 1000 pages, 0.00 percent used14:56:55 DR: Sending Logical Logs Completed14:56:56 DR: Primary server operational从上面可以看到数据库之间的执行步骤。
6,此时数据库的状态为:[informix@test02 informix]$ onstat -IBM Informix Dynamic Server Version 10.00.UC4 -- Read-Only (Sec) -- Up 00:04:58 -- 237528 Kbytes
[informix@test02 informix]$
主服务器的数据库状态为:
[informix@test01 informix]$ onstat -
IBM Informix Dynamic Server Version 10.00.UC4 -- On-Line (Prim) -- Up 00:09:36 -- 229336 Kbytes
[informix@test01 informix]$
7,此时在test01上面执行的ontape -s -L 0 -F | rsh test02 "ontape -p " 命令还没有结束,在test02上面执行onmode -ky关闭数据库,然后重新启动,此时test01上面的任务完成退出。8,在test01上面重新建立一个库,然后在test02上面查看是否有新的库,测试HDR是否成功。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/312079/viewspace-245838/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/312079/viewspace-245838/