master 192.168.1.127 提供TOLOWER服务
backup 192.168.1.128 提供TOLOWER服务
客户端程序 simpcl.c 中tpcall调用TOLOWER 服务。
ret = tpcall("TOLOWER", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
服务端程序 simpserv.c 增加TOLOWER 函数,保证客户端能够调用。
void TOLOWER(TPSVCINFO *rqst)
{
int i;
for(i = 0; i < rqst->len-1; i++)
rqst->data[i] = tolower(rqst->data[i]);
/* Return the transformed buffer to the requestor. */
tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}
一:环境
linux:centos 6.2 i386
tuxedo: Oracle Tuxedo, Version 11.1.1.2.0, 32-bit, Patch Level (none)
需要的文件:
lower 编译好的客户端调用tolower服务的程序。
toupper编译好的客户端调用toupper服务的程序
bdmconfig 编译好的二进制域配置文件
二详细操作步骤
1.设置环境变量
建议两台机子最好一样,避免出错。
TUXDIR=/home/tux/Oracle; export TUXDIR
JAVA_HOME=$TUXDIR/jre; export JAVA_HOME
JVMLIBS=$JAVA_HOME/lib/i386/server:$JAVA_HOME/jre/bin
PATH=$TUXDIR/bin:$JAVA_HOME/bin:$PATH; export PATH
COBCPY=:$TUXDIR/cobinclude; export COBCPY
COBOPT="-C ANS85 -C ALIGN=8 -C NOIBMCOMP -C TRUNC=ANSI -C OSEXT=cbl"; export COBOPT
SHLIB_PATH=$TUXDIR/lib:$JVMLIBS:$SHLIB_PATH; export SHLIB_PATH
LIBPATH=$TUXDIR/lib:$JVMLIBS:$LIBPATH; export LIBPATH
LD_LIBRARY_PATH=$TUXDIR/lib:$JVMLIBS:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
WEBJAVADIR=$TUXDIR/udataobj/webgui/java; export WEBJAVADIR
LANG=C; export LANG
APPDIR=/home/tux/simpapp; export APPDIR
TUXCONFIG=$APPDIR/tuxconfig; export TUXCONFIG
BDMCONFIG=/home/tux/simpapp/bdmconfig; export BDMCONFIG
2 .编写ubbconfig 文件
以下是master机子上的,只提供tolower服务。backup机子类似,只不过把服务改成toupper。
[tux@master simpapp]$ vi ubbsimple
MASTER TUX1
MAXACCESSERS 150
MAXSERVERS 120
MAXSERVICES 120
MODEL SHM
*MACHINES
DEFAULT:
master LMID=TUX1
APPDIR="/home/tux/simpapp"
TUXCONFIG="/home/tux/simpapp/tuxconfig"
TUXDIR="/home/tux/Oracle"
MAXWSCLIENTS=5
*GROUPS
GROUP1 LMID=TUX1 GRPNO=1 OPENINFO=NONE
LDMGRP LMID=TUX1 GRPNO=20
LGWGRP LMID=TUX1 GRPNO=30
*SERVERS
DEFAULT:
CLOPT="-A"
simpserv SRVGRP=GROUP1 SRVID=1
WSL SRVGRP=GROUP1 SRVID=10
CLOPT="-A -- -n //192.168.1.127:3200 -m 2 -M 5 -x 10 -p 4500 -P 5000"
DMADM SRVGRP=LDMGRP SRVID=1
GWADM SRVGRP=LGWGRP SRVID=100
GWTDOMAIN SRVGRP=LGWGRP SRVID=200 REPLYQ=N
*SERVICES
TOLOWER
3.编写domconfig文件
master机器的配置文件:
*DM_RESOURCES
VERSION=test1
*DM_LOCAL_DOMAINS
LAPP GWGRP=LGWGRP
TYPE=TDOMAIN
DOMAINID="LAPP"
DMTLOGDEV="/home/tux/simpapp/DLOG"
*DM_REMOTE_DOMAINS
UAPP TYPE=TDOMAIN
DOMAINID="UAPP"
*DM_TDOMAIN
LAPP NWADDR="//192.168.1.127:7000"
UAPP NWADDR="//192.168.1.128:7000"
*DM_REMOTE_SERVICES
TOUPPER
*DM_LOCAL_SERVICES
TOLOWER
backup远端机器域配置文件如下:
*DM_RESOURCES
VERSION=Utest1
*DM_LOCAL_DOMAINS
UAPP GWGRP=UGWGRP
TYPE=TDOMAIN
DOMAINID="UAPP"
DMTLOGDEV="/home/tux/simpapp/DLOG"
*DM_REMOTE_DOMAINS
LAPP TYPE=TDOMAINDOMAINID="LAPP"
*DM_TDOMAIN
LAPP NWADDR="//192.168.1.127:7000"
UAPP NWADDR="//192.168.1.128:7000"
*DM_LOCAL_SERVICES
TOUPPER
*DM_REMOTE_SERVICES
TOLOWER
4.在backup机子上执行如上1、2、3操作。只更改服务为toupper服务。
5. 编译配置文件,以及客户端和服务端程序。
buildserver -f simpserv -o simpserv -s TOUPPER -s TOLOWER
buildclient -f simpcl.c -o lower
tmloadcf -y ubbsimple (执行之后会生成tuxconfig二进制文件)
dmloadcf -y dmconfig(执行后会生成bdmconfig二进制文件)
6.启动tuxedo。
7.至此整个配置过程已经结束。接下来看一下tuxedo客户端调用服务。我们的客户端是不知道服务在哪台机子上的。
tolower服务在master机子上,我们可以在backup机子的客户端调用tolower服务。因为bakcup机子上的UAPP domain 中不包括这个服务,他就会调用远端机子的tolower的服务。
首先我们看 master机子的服务还没有一笔交易:
[tux@master simpapp]$ tmadmin
tmadmin - Copyright (c) 1996-2010 Oracle.
Portions * Copyright 1986-1997 RSA Data Security, Inc.
All Rights Reserved.
Distributed under license by Oracle.
Tuxedo is a registered trademark.
> d -m TUX1
TUX1> psr
Prog Name Queue Name Grp Name ID RqDone Load Done Current Service
--------- ---------- -------- -- ------ --------- ---------------
BBL 123456 TUX1000 ( IDLE )
DMADM 00020.00001 LDMGRP 17350 ( IDLE )
simpserv 00001.00001 GROUP1100 ( IDLE )
WSL 00001.00010 GROUP11000 ( IDLE )
GWADM 00030.00100 LGWGRP 10000 ( IDLE )
GWTDOMAIN 00030.00200 LGWGRP 20000 ( IDLE )
TUX1>
在远端机子调用:
[tux@backup simpapp]$ ./lower "HELLO WORLD"
Returned string is: hello world
[tux@backup simpapp]$
查看master机子 已经有一笔交易:这笔交易就是由远端的tuxedo客户端调用。
TUX1> psr
Prog Name Queue Name Grp Name ID RqDone Load Done Current Service
--------- ---------- -------- -- ------ --------- ---------------
BBL 123456 TUX1000 ( IDLE )
DMADM 00020.00001 LDMGRP 17350 ( IDLE )
simpserv 00001.00001 GROUP11150 ( IDLE )
WSL 00001.00010 GROUP11000 ( IDLE )
GWADM 00030.00100 LGWGRP 10000 ( IDLE )
GWTDOMAIN 00030.00200 LGWGRP 20000 ( IDLE )
TUX1>
----------------------------------------------------------------------------------------------------------------------------------------
同理我们在master 机器调用调用远端机子的toupper服务
调用之前:
[tux@backup simpapp]$ tmadmin
tmadmin - Copyright (c) 1996-2010 Oracle.
Portions * Copyright 1986-1997 RSA Data Security, Inc.
All Rights Reserved.
Distributed under license by Oracle.
Tuxedo is a registered trademark.
> d - m^H
TMADMIN_CAT:145: ERROR: Syntax error on command line.
> d -m backup
backup> psr
Prog Name Queue Name Grp Name ID RqDone Load Done Current Service
--------- ---------- -------- -- ------ --------- ---------------
BBL 123456 backup 000 ( IDLE )
DMADM 00020.00001 UDMGRP 17350 ( IDLE )
simpserv 00001.00001 GROUP1100 ( IDLE )
WSL 00001.00010 GROUP11000 ( IDLE )
GWADM 00030.00100 UGWGRP 10000 ( IDLE )
GWTDOMAIN 00030.00200 UGWGRP 20010 ( IDLE )
backup>
调用之后;
[tux@master simpapp]$ ./toupper zhoulei
Returned string is: ZHOULEI
[tux@master simpapp]$
backup> psr
Prog Name Queue Name Grp Name ID RqDone Load Done Current Service
--------- ---------- -------- -- ------ --------- ---------------
BBL 123456 backup 000 ( IDLE )
DMADM 00020.00001 UDMGRP 17350 ( IDLE )
simpserv 00001.00001 GROUP11150 ( IDLE )
WSL 00001.00010 GROUP11000 ( IDLE )
GWADM 00030.00100 UGWGRP 10000 ( IDLE )
GWTDOMAIN 00030.00200 UGWGRP 20010 ( IDLE )
backup>
最基本的tuxedo多域模式配置,仅供学习。
--转自