1. 现象: 用户通过ODBC在DataStage连接SAP Sybase IQ集群数据库(11节点),VIP对应域名 dgiq-db 。
ODBC设置:
[ODBC_IPD_IQ_SERVER]
Driver=/etldata/dsadm/InformationServer/Server/branded_odbc/lib/VMsyiq00.so
Description=DataDirect Sybase IQ Wire Protocol Driver
Database=iqdm
NetworkAddress=dgiq-db,10000
用户通过此ODBC查询报错,具体DataStage报错信息:
SRC_BAS_INNO_MOBILE_LOG_ILEADER_F: ODBC function "SQLConnect" reported: SQLSTATE = 28000: Native Error Code = 4,002: Msg = [IBM(DataDirect OEM)][ODBC Sybase IQ Wire Protocol driver][Sybase IQ]Login Failed. Check for valid user ID, server name and password.
ODBC function "SQLConnect" reported: SQLSTATE = HY000: Native Error Code = 21: Msg = [IBM(DataDirect OEM)][ODBC Sybase IQ Wire Protocol driver][Sybase IQ]SQL Anywhere Error -1013118: Login denied to logical server 'iqdm_dmipd_logical_server', Either the server is not part of the logical server or does not match the node type or login redirection is disabled.
-- (stcxtlib/st_lsMgr.cxx 826) (CC_OdbcConnection::connect, file CC_OdbcConnection.cpp, line 584)
2. 分析:
dmipd用户的Logical Server分配在 2,7,8,9四台IQ主机(通过Logical server设置),因为DataStage上的
IQ ODBC重定向(redirect)可能有问题(怀疑),如果使用VIP或域名,可能 vip 会指定连接集群中11个节点的
任意一个,比如dggbi01-iq 这个节点上,到了这个节点后,因为重定向有问题,logical server不会将链接引
导到 2,7,8,9 节点(对DMIPD是合法的),所以才会提示:
这个服务器不是逻辑服务器的一部分 或 login重定向被disabled 。
具体错误将上面。
3. 解决方法:
由于怀疑是DataStage上的ODBC驱动没有redirect(重定向)的功能,可能是ODBC驱动太老了(DS上我记得用
的是IQ 12版本的驱动,那时候估计还没有logical server重定向功能 )。
我们将VIP部分更改为单机。如下:
[ODBC_IPD_IQ_SERVER]
Driver=/etldata/dsadm/InformationServer/Server/branded_odbc/lib/VMsyiq00.so
Description=DataDirect Sybase IQ Wire Protocol Driver
Database=iqdm
NetworkAddress="dggbi09-iq,10000"
4. 我们加入了 AlternateServers ,但是发现报错,估计是驱动太老了。后期会升级ODBC驱动
验证failover功能(高可用)。如下最后一行。
[ODBC_IPD_IQ_SERVER]
Driver=/etldata/dsadm/InformationServer/Server/branded_odbc/lib/VMsyiq00.so
Description=DataDirect Sybase IQ Wire Protocol Driver
Database=iqdm
NetworkAddress="dggbi09-iq,10000"
AlternateServers=(NetworkAddress="dggbi02-iq,10000", NetworkAddress="dggbi08-iq,10000",NetworkAddress="dggbi07-iq,10000")
AlternateServers -- 一旦单机连接异常,会连接到AlternateServers指定的主机。
参考 :
http://media.datadirect.com/download/docs/odbc/allodbc/index.html#page/odbc%2FAlternate_Servers_12.html%23
Alternate Servers
Attribute
AlternateServers (ASRV)
Purpose
A list of alternate database servers to which the driver tries to connect if the primary database server is unavailable. Specifying a value for this option enables connection failover for the driver. The value you specify must be in the form of a string that defines the physical location of each alternate server. All of the other required connection information for each alternate server is the same as what is defined for the primary server connection.
Valid Values
({NetworkAddress=addressvalue | InterfacesFileServerName=sectionvalue}[, ...])
NetworkAddress and InterfacesFileServerName can be used in the same string.