[informix]在有大量数据的情况下,添加HDR节点

2012年2月1日 6108点热度 0人点赞 0条评论

◆在有大量数据的情况下,添加HDR节点。
建立hdr节点的步骤如下:
1、主机信任关系建立;(参见“IDS---配置客户端.txt”)
2、lv准备:lv的名称、大小、属性必须与主节点保持一致;
3、sqlhosts文件准备:在相应节点配置该文件一致;
4、准备onconfig文件:在主节点文件基础上修改即可;
5、初始化,并建立数据库空间:copy执行主节点的onspaces脚本;
6、保持hdr启动状态,之后顺序执行如下步骤:
pri执行:onmode -d primary rmsdb_hdr
(通知hdr节点,哪个是主节点)
hdr执行:onmode -ky
(关闭hdr节点)
pri执行:ontape -s -L 0 -t STDIO -F|rsh sdalarm2 ". ./setenv_otherdb;ontape -p -t STDIO"
(通过管道的方式备份pri节点数据,恢复到hdr节点,此时hdr会自动启动,状态由 not initialized 变为 Initialization,进而变为 Fast Recovery;注,此步骤所需的执行时间视数据库的数据量而定,一个数据库空间60G左右的数据库,通过远程万兆网络,所需时间为23分钟。)
hdr执行:onmode -d secondary otherdb_pri
(稍等一下,可以看到hdr状态由 Fast Recovery 变化为 Updatable (Sec) )
◆以下记录了hdr节点状态的转变过程:
IBM Informix Dynamic Server Version 11.50.FC9 -- Initialization -- Up 00:00:05 -- 19633840 Kbytes
IBM Informix Dynamic Server Version 11.50.FC9 -- Fast Recovery -- Up 00:00:15 -- 19633840 Kbytes
IBM Informix Dynamic Server Version 11.50.FC9 -- Fast Recovery (Sec) -- Up 00:02:58 -- 19633840 Kbytes
IBM Informix Dynamic Server Version 11.50.FC9 -- Updatable (Sec) -- Up 00:03:03 -- 19633840 Kbytes
◆以下是rmsdb数据库集群三个节点的状态:PRI+SDS+HDR
rmsdb_pri@sdwgpm1:/opt/IBM/informix/etc>onstat -
IBM Informix Dynamic Server Version 11.50.FC9 -- On-Line (Prim) -- Up 4 days 18:53:50 -- 19633840 Kbytes
rmsdb_sds@sdwgpm2:/u1/informix>onstat -
IBM Informix Dynamic Server Version 11.50.FC9 -- Updatable (SDS) -- Up 4 days 18:52:27 -- 19633840 Kbytes
rmsdb_hdr@sdalarm2:/opt/IBM/informix>onstat -
IBM Informix Dynamic Server Version 11.50.FC9 -- Updatable (Sec) -- Up 00:04:27 -- 19633840 Kbytes
◆三个节点配置的CM启用了负载均衡,如下:
rmsdb_hdr@sdalarm2:/opt/IBM/informix>onstat -g cmsm
IBM Informix Dynamic Server Version 11.50.FC9 -- Updatable (Sec) -- Up 00:14:00 -- 19633840 Kbytes
Connection Manager Name: cm_rmsdb
Hostname: sdwgpm2

SLA                    Connections   Service/Protocol   Rule
qxgl                         20173      9978/onsoctcp   (PRI+SDS+HDR)

Failover Configuration:
Connection Manager name        Rule                Timeout   State
cm_rmsdb
SDS+HDR                  10   Primary is up

◆所以可以看到SLA的指向情况如下:
1:37:51 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_pri 10.19.65.162.9977
11:39:19 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_sds 10.19.65.164.9977
11:39:26 Connection Manager successfully connected to rmsdb_hdr
(可见启用HDR以后,CM自动连接到此实例)
11:40:25 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_pri 10.19.65.162.9977
11:40:26 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_hdr 10.213.11.28.9977
11:40:31 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_sds 10.19.65.164.9977
11:41:16 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_pri 10.19.65.162.9977
11:41:35 SLA qxgl redirect SQLI client from 10.19.65.139 to rmsdb_hdr 10.213.11.28.9977
11:41:35 SLA qxgl redirect SQLI client from 10.19.65.139 to rmsdb_sds 10.19.65.164.9977
11:41:36 SLA qxgl redirect SQLI client from 10.19.65.139 to rmsdb_sds 10.19.65.164.9977
11:42:48 SLA qxgl redirect SQLI client from 10.19.65.139 to rmsdb_hdr 10.213.11.28.9977
11:45:05 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_sds 10.19.65.164.9977
11:45:05 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_hdr 10.213.11.28.9977
11:46:28 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_sds 10.19.65.164.9977
11:47:10 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_hdr 10.213.11.28.9977
11:47:14 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_pri 10.19.65.162.9977
11:47:14 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_pri 10.19.65.162.9977
11:48:25 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_hdr 10.213.11.28.9977
11:48:25 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_hdr 10.213.11.28.9977
11:48:57 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_pri 10.19.65.162.9977
11:48:58 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_hdr 10.213.11.28.9977
11:48:58 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_pri 10.19.65.162.9977
11:49:26 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_pri 10.19.65.162.9977
11:49:53 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_hdr 10.213.11.28.9977
11:49:53 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_hdr 10.213.11.28.9977
11:50:25 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_pri 10.19.65.162.9977
11:50:57 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_pri 10.19.65.162.9977
11:50:57 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_hdr 10.213.11.28.9977
11:51:16 SLA qxgl redirect SQLI client from 10.19.65.139 to rmsdb_sds 10.19.65.164.9977
可见SLA qxgl分配到了不同的数据库server,实现了负载均衡的效果。再看刚才的log:
rmsdb_sds@sdwgpm2:/opt/IBM/informix/tmp>tail -f cm_rmsdb.log
12:54:54 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_sds 10.19.65.164.9977
12:55:21 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_pri 10.19.65.162.9977
12:56:20 SLA qxgl redirect SQLI client from 10.19.65.139 to rmsdb_pri 10.19.65.162.9977
12:56:53 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_pri 10.19.65.162.9977
12:58:10 SLA qxgl redirect SQLI client from 10.19.65.139 to rmsdb_hdr 10.213.11.28.9977
12:58:12 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_hdr 10.213.11.28.9977
12:58:12 SLA qxgl redirect SQLI client from 10.19.65.117 to rmsdb_hdr 10.213.11.28.9977
12:58:27 SLA qxgl redirect SQLI client from 10.19.65.139 to rmsdb_sds 10.19.65.164.9977
12:58:27 SLA qxgl redirect SQLI client from 10.19.65.139 to rmsdb_sds 10.19.65.164.9977
12:58:35 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_pri 10.19.65.162.9977
13:02:34 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_hdr 10.213.11.28.9977
13:02:46 SLA qxgl redirect SQLI client from 10.19.65.162 to rmsdb_hdr 10.213.11.28.9977

◆关于对 chunks/spaces 的操作,在 HDR 对中,当需要添加 / 删除 chunks/dbspace 时,需要注意的是:操作只能在主服务器进行,操作可以由 HDR 主服务器自动同步到辅助服务器,主辅服务器需要预先创建相应的文件或者 link。
◆关于 RAW table,在实际应用中,为了加快数据更新速度,有时候需要使用 RAW 类型的数据表,在 HDR 环境下对 RAW 类型数据表需要注意以下几点:在主服务器上可以创建、删除、访问 RAW 类型的数据表,但是不能修改 RAW 类型为 STANDARD 类型,也不能修改 STANDARD 类型为 RAW 类型 , 否则会得到 -19845 错误。 在辅助服务器上不能对 RAW 类型数据表进行任何形式的访问,否则会得到 -19846 错误。
◆关于 BLOB 和 CLOB 数据类型,在 IDS11.5 的 HDR 环境下是可以使用 BLOB/CLOB 数据类型,也就是说对 BLOB/CLOB 数据的更新可以通过 HDR 自动同步,在辅助服务器同样可以对 BLOB/CLOB 数据进行更新操作。

liking

这个人很懒,什么都没留下

文章评论