tuxedo负载均衡和多域测试附件_MQ, Tuxedo及OLTP讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MQ, Tuxedo及OLTP讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 6867 | 回复: 0   主题: tuxedo负载均衡和多域测试附件        下一篇 
napolenAx
注册用户
等级:少校
经验:802
发帖:118
精华:1
注册:2011-8-30
状态:离线
发送短消息息给napolenAx 加好友    发送短消息息给napolenAx 发消息
发表于: IP:您无权察看 2011-10-24 16:49:58 | [全部帖] [楼主帖] 楼主

11. 附录

11.1 simpsvrUp
#include
#include "atmi.h"
void TOUPPER(TPSVCINFO *rqst)
{
      int i;
      char *buf;
      long sendlen,rcvlen;
      for(i = 0; i < rqst->len-1; i++)
      rqst->data[i] = toupper(rqst->data[i]);
      userlog("From Client ReqId[%s]",rqst->data);
      sendlen = rqst->len;
      if((buf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL)
      {
            (void) fprintf(stderr,"Error allocating send buffer\n");
            tpterm();
            exit(1);
      }
      (void) strcpy(buf, rqst->data);
      if (tpcall("TOLOWER", (char *) buf, 0, (char **)&buf, &rcvlen, (long)0 ) == -1)
      {
            userlog( "TPCALL ERROR CODE %d message[%s]", tperrno, tpstrerror(tperrno));
            (void) fprintf(stderr, "Tperrno = %d\n", tperrno);
            tpfree( buf);
            tpreturn(TPSUCCESS, 0, buf, 0L, 0);
      }
      userlog("Call Remote ToLower Success [%s]", buf);
      tpreturn(TPSUCCESS, 0, buf, 0L, 0);
}
11.2 simpsvrLow
#include
#include "atmi.h"
void TOLOWER(TPSVCINFO *rqst)
{
      int i;
      for(i = 0; i < rqst->len-1; i++)
      rqst->data[i] = tolower(rqst->data[i]);
      userlog("From Client ReqId[%s]",rqst->data);
      printf("In ToLower");
      //sleep(10);
      tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}
11.3 ubbmp
*RESOURCES
IPCKEY 45678
MASTER site1,site2
MAXACCESSERS 1000
MAXSERVERS 200
MAXSERVICES 100
MODEL MP
LDBAL Y
OPTIONS LAN,MIGRATE
*MACHINES
FireCat1 LMID=site1
UID=508
GID=508
APPDIR="/home/tuxapp/tuxedo"
TUXCONFIG="/home/tuxapp/tuxedo/tuxconfig"
TUXDIR="/home/tuxedo/tuxedo8.1"
TYPE="linux"
MAXWSCLIENTS=100
FireCat2 LMID=site2
UID=508
GID=508
APPDIR="/home/tuxapp/tuxedo"
TUXCONFIG="/home/tuxapp/tuxedo/tuxconfig"
TUXDIR="/home/tuxedo/tuxedo8.1"
TYPE="LINUX"
MAXWSCLIENTS=100
*GROUPS
GROUP1
LMID=site1 GRPNO=1 OPENINFO=NONE
GROUP2
LMID=site2 GRPNO=2 OPENINFO=NONE
*NETWORK
site1 NADDR="//192.168.8.120:6009"
NLSADDR="//192.168.8.120:8888"
site2 NADDR="//192.168.8.121:7010"
NLSADDR="//192.168.8.121:8888"
*SERVERS
DEFAULT:
RESTART=N MAXGEN=5 REPLYQ=Y CLOPT="-A"
WSL SRVGRP=GROUP1 SRVID=1
CLOPT="-A — -n //192.168.8.120:9502 -m 5 -x 5 -M 30"
WSL SRVGRP=GROUP2 SRVID=100
CLOPT="-A — -n //192.168.8.121:9502 -m 5 -x 5 -M 30"
simpsvr SRVGRP=GROUP2 SRVID=11 RQADDR=RQ_simp1 RQPERM=0666 CLOPT="-A -p 1,10:2,1 " MIN=5 MAX=10
simpsvr SRVGRP=GROUP1 SRVID=111 RQADDR=RQ_simp2 RQPERM=0666 CLOPT="-A -p 1,10:2,1 " MIN=5 MAX=10
*SERVICES
11.4 country ubbdm
*RESOURCES
IPCKEY 240000
MASTER tuxtest
PERM 0666
MAXACCESSERS 1000
MAXSERVERS 50
MAXSERVICES 100
MODEL SHM
LDBAL Y
SCANUNIT 5
SANITYSCAN 12
BBLQUERY 30
DBBLWAIT 2
BLOCKTIME 6
*MACHINES
DEFAULT:
CharlesLinux LMID=tuxtest
MAXWSCLIENTS=100
APPDIR="/home/tuxapp/tuxedo"
TUXCONFIG="/home/tuxapp/tuxedo/tuxconfig"
TUXDIR="/home/tuxedo/tuxedo8.1"
ULOGPFX="/home/tuxapp/tuxedo/ULOG"
*GROUPS
ADMIN
LMID=tuxtest GRPNO=1 OPENINFO=NONE
REMIT
LMID=tuxtest GRPNO=2 OPENINFO=NONE
DOMGRP
LMID=tuxtest GRPNO=3
DOMGRP1
LMID=tuxtest GRPNO=4
DOMGRP2
LMID=tuxtest GRPNO=5
*SERVERS
DEFAULT:
CLOPT="-A " REPLYQ=Y RESTART=Y GRACE=0 MAXGEN=5
WSL SRVGRP=ADMIN SRVID=1
CLOPT="-A -t — -n //111.111.111.22:6666-m 10 -M 100 -x 5"
simpsvrUp SRVGRP=REMIT SRVID=10 RQADDR=RQ_simpUp RQPERM=0666 CLOPT="-A – p 1,10:2,1 " MIN=2 MAX=10
DMADM SRVGRP=DOMGRP SRVID=3050 REPLYQ=N RESTART=Y GRACE=0
GWADM SRVGRP=DOMGRP1 SRVID=3051 REPLYQ=N RESTART=Y GRACE=0
GWTDOMAIN SRVGRP=DOMGRP1 SRVID=3052 RQADDR=RQ_GWT1 REPLYQ=Y RESTART=Y MIN=1 MAX=1
GWADM SRVGRP=DOMGRP2 SRVID=3053 REPLYQ=N RESTART=Y GRACE=0
GWTDOMAIN SRVGRP=DOMGRP2 SRVID=3054 RQADDR=RQ_GWT2 REPLYQ=Y RESTART=Y MIN=1 MAX=1
*SERVICES
11.5 countrydom
*DM_RESOURCES
*DM_LOCAL_DOMAINS
HOME1 GWGRP=DOMGRP1
CONNECTION_POLICY=ON_STARTUP
TYPE=TDOMAIN
DOMAINID="EPR111"
BLOCKTIME=10
MAXDATALEN=1000
MAXRDOM=89
#DMTLOGDEV="/home/tuxapp/tuxedo/tlog/DMTLOG"
HOME2 GWGRP=DOMGRP2
CONNECTION_POLICY=ON_STARTUP
TYPE=TDOMAIN
DOMAINID="EPR112"
BLOCKTIME=10
MAXDATALEN=1000
*DM_REMOTE_DOMAINS
RMTGJ TYPE=TDOMAIN
DOMAINID=EPRGJ
*DM_TDOMAIN
HOME1 NWADDR="//111.111.111.22.:6651"
HOME2 NWADDR="//111.111.111.22:6652"
RMTGJ NWADDR="//111.111.111.33:6660"
*DM_LOCAL_SERVICES
TOUPPER
*DM_REMOTE_SERVICES
TOLOWER
# TOLOWER LDOM= HOME1 RDOM= RMTGJ RNAME= TOLOWER
# TOLOWER LDOM= HOME2 RDOM= RMTGJ RNAME= TOLOWER
11.6 world ubbdm
*RESOURCES
IPCKEY 240000
MASTER tuxtest
PERM 0666
MAXACCESSERS 1000
MAXSERVERS 50
MAXSERVICES 100
MODEL SHM
LDBAL Y
SCANUNIT 5
SANITYSCAN 12
BBLQUERY 30
DBBLWAIT 2
BLOCKTIME 6
*MACHINES
DEFAULT:
localhost LMID=tuxtest
MAXWSCLIENTS=100
APPDIR="/home/tuxapp/tuxedo"
TUXCONFIG="/home/tuxapp/tuxedo/tuxconfig"
TUXDIR="/home/tuxedo/tuxedo8.1"
ULOGPFX="/home/tuxapp/tuxedo/ULOG"
TLOGDEVICE="/home/tuxapp/tuxedo/tlog/TLOG"
*GROUPS
ADMIN
LMID=tuxtest GRPNO=1 OPENINFO=NONE
REMIT
LMID=tuxtest GRPNO=2 OPENINFO=NONE
DOMGRP
LMID=tuxtest GRPNO=3
*SERVERS
DEFAULT:
CLOPT="-A " REPLYQ=Y RESTART=Y GRACE=0 MAXGEN=5
WSL SRVGRP=ADMIN SRVID=1
CLOPT="-A — -n //111.111.111.121:6669 -m 1 -M 100 -x 5"
simpsvrLow SRVGRP=REMIT SRVID=110 RQADDR=RQ_simpLow RQPERM=0666 CLOPT="- A – p 1,10:2,1 " MIN=2 MAX=10
DMADM SRVGRP=DOMGRP SRVID=3050 REPLYQ=N
GWADM SRVGRP=DOMGRP SRVID=3051 REPLYQ=N
GWTDOMAIN SRVGRP=DOMGRP SRVID=3052 REPLYQ=Y
*SERVICES
11.7 worlddom
*DM_RESOURCES
*DM_LOCAL_DOMAINS
HOME GWGRP=DOMGRP
TYPE=TDOMAIN
DOMAINID="EPRGJ"
BLOCKTIME=10
MAXDATALEN=1000
MAXRDOM=89
#DMTLOGDEV="/home/tuxapp/tuxedo/tlog/DMTLOG"
*DM_REMOTE_DOMAINS
RMT111 TYPE=TDOMAIN
DOMAINID=EPR111
RMT112 TYPE=TDOMAIN
DOMAINID=EPR112
*DM_TDOMAIN
HOME NWADDR="//111.111.111.121:6660"
RMT111 NWADDR="//111.111.111.120:6651"
RMT112 NWADDR="//111.111.111.120:6652"
*DM_LOCAL_SERVICES
#TOUPPER
TOLOWER
*DM_REMOTE_SERVICES
TOUPPER
#TOLOWER
11.8 LoadRunner Script
vuser_init:
vuser_init()
{
      return 0;
}
Action:
#include "lrt.h"
#include "replay.vdf"
Action()
{
      lrt_tuxputenv("WSNADDR=//111.111.111.22:6666");
      tpresult_int = lrt_tpinitialize(LRT_END_OF_PARMS);
      lrt_abort_on_error();
      data_0 = lrt_tpalloc("STRING", "", 4);
      lrt_strcpy(data_0, sbuf_1);
      data_1 = lrt_tpalloc("STRING", "", 4);
      tpresult_int = lrt_tpcall("TOUPPER",
      data_0,
      0,
      &data_1,
      &olen,
      0);
      lrt_abort_on_error();
      lrt_tpfree(data_0);
      lrt_tpfree(data_1);
      lrt_tpterm();
      return 0;
}
vuser_end:
vuser_end()
{
      return 0;
}
replay.vdf:
#ifndef TUXVDF_H
#define TUXVDF_H
char* data_0;
char* data_1;
static const char sbuf_1[] =
"yyy";
/* Reply STRING buffer 1
"yyy"
"\x0";
Reply buffer */
#endif
11.9 bang Program
#include
#include"atmi.h"
#include
#include
#include
#include
#include
voidPrtMillTime(char*);
voidscallserver(intbuflen,char*sbuf);
main(void)
{
      inti,j;
      charsToDo[200];
      charsReqId[11];
      pid_tchild;
      memset(sToDo,’\0′,sizeof(sToDo));
      memset(sReqId,’\0′,sizeof(sReqId));
      PrtMillTime(sReqId);
      printf("starttime[%s]\n",sReqId);
      for(i=0;i<=30;i++)
      {
            if((child=fork())==-1)
            {
                  //printf("ForkError:%s\n",strerror(errno));
                  printf("ForkError\n");
                  exit(1);
            }
            elseif(child==0)
            {
                  sprintf(sToDo,"%s%d\n","/home/tuxapp/bin/simpcli",getpid());
                  for(j=0;j<100;j++)
                  {
                        //PrtMillTime(sReqId);
                        //printf("Iamthechild:%ld\n",getpid());
                        sprintf(sToDo,"%d",getpid());
                        scallserver(1,sToDo);
                  }
                  exit(2);
            }
      }
      PrtMillTime(sReqId);
      printf("endtime[%s]\n",sReqId);
      exit(0);
}
voidPrtMillTime(char*sDesc)
{
structtm*tmCurTime;
structtimebtbTimeBlock;
charszDescription[41];
charsRet[20];
memset(szDescription,0,sizeof(szDescription));
strncpy(szDescription,sDesc,40);
memset(sRet,’\0′,sizeof(sRet));
ftime(&tbTimeBlock);
tmCurTime=localtime(&tbTimeBlock.time);
sprintf(sDesc,"%02d%02d%02d%02d%03d",
tmCurTime->tm_mday,tmCurTime->tm_hour,
tmCurTime->tm_min,tmCurTime->tm_sec,tbTimeBlock.millitm);
}
voidscallserver(intbuflen,char*sbuf)
{
      char*buf;
      longsendlen,rcvlen;
      intret;
      if(tpinit((TPINIT*)NULL)==-1){
            (void)fprintf(stderr,"Tpinitfailed\n");
            exit(1);
      }
      sendlen=strlen(sbuf);
      if((buf=(char*)tpalloc("STRING",NULL,sendlen+1))==NULL){
            (void)fprintf(stderr,"Errorallocatingsendbuffer\n");
            tpterm();
            exit(1);
      }
      (void)strcpy(buf,sbuf);
      ret=tpcall("TOUPPER",(char*)buf,0,(char**)&buf,&rcvlen,(long)0);
      if(ret==-1){
            (void)fprintf(stderr,"Can’tsendrequesttoserviceTOUPPER\n");
            (void)fprintf(stderr,"Tperrno=%dmessage[%s]\n",tperrno,tpstrerror(tperrno));
            tpfree(buf);
            tpterm();
            exit(1);
      }
      tpfree(buf);
      tpterm();
}




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论