`
helloyesyes
  • 浏览: 1265883 次
  • 性别: Icon_minigender_2
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

Tuxedo配置及简单应用

阅读更多
1. 设置环境变量
TUXDIR=<Tuxedo软件所在路径>
APPDIR=<应用程序所在路径>
PATH=<必须包含路径%TUXDIR%\BIN>
TUXCONFIG=<配置文件tuxconfig的全路径>
WSNADDR=<服务器地址,客户端使用>
LD_LIBRARY_PATH=%LD_LIBRARY_PATH%;%TUXDIR%\LIB
2. 编辑样本配置文件ubbsimple,修改相应内容。
IPCKEY 区别于其他用户的变量(32767..262143)
TUXCONFIG <二进制配置文件tuxconfig的全路径>
TUXDIR <Tuxedo软件所在目录>
APPDIR <应用程序所在目录>
Machine-name <机器名称>
3. 使用如下命令建立二进制配置文件:
tmloadcf <ascii码配置文件>
4. 使用如下命令建立服务器端和客户端可执行程序
buildclient –v –w –o simpcl –f simpcl.c
buildserer –v –o simpserv –f simpserv.c –s touppers
注:
simpcl client可执行程序。
simpcl.c client源程序。
simpserv server端可执行程序。
simpserv.c server端源程序。
touppers service名称。
5. 使用如下命令启动server端应用环境(由二进制配置文件定义):
tmboot –y
6. 使用如下命令可以显示和修改运行进程的参数。
tmadmin
有两个子命令:
psr (printserver) 显示有关服务器的信息。
psc (printservice) 显示有关服务进程的信息。
7. 可以通过查看日志文件ULOG.*来获取系统运行信息。
日志文件信息格式如下:
time (hhmmss).machine_uname!process_name.process_id: log message
说明:时间(hhmmss).机器名称.进程名.进程号.日志信息
8. 使用如下命令关闭应用环境:
tmshutdown –y
参数:
-A 在所有机器上启动/关闭管理的Server进程
-M 只在MASTER机器上启动/关闭管理的Server进程
-i srvid 启动/关闭某个serverid指定的Server进程
-g grpname 启动/关闭某个servergroup名字指定的ServerGroup
-S 启动/关闭所有应用服务器(LMID)
-s server-name 启动/关闭某个server名字指定的Server进程
-l lmidoption在指定的机器上启动/关闭所有TMS进程和应用服务器(LMID)
-T grpname 启动/关闭指定的servergroup中所有的TMS进程
-B lmid 在指定的机器上启动/关闭BBL进程
-e command 指定一个程序可以当在MASTER机器上启动任何一个进程失败时执行
-c 计算出当前UBB配置的Tuxedo启动最少要占用的系统IPC资源
9. UBBCONFIG文件的例子:
#ident "@(#) apps/simpapp/ubbsimple $Revision: 1.3 $"
#Skeleton UBBCONFIG file for the TUXEDO Simple Application.
#Replace the <bracketed> items with the appropriate values.
*RESOURCES
IPCKEY 123456
#Example:
#IPCKEY 123456
#DOMAIN的ID值
DOMAINID simpapp
#指定DOMAIN中的管理
MASTER simple
#这里该值表示整个系统中每个机器上可以访问TUXEDO的Client和Server的总数
MAXACCESSERS 100
#最大的server数
MAXSERVERS 5
#最大的service数
MAXSERVICES 10
#cluster方式为MP,否则为SHM
MODEL SHM
#允许负载均衡
LDBAL N
*MACHINES
#网络主机名用hostname获得。
#LMID:Logical Machines ID 为tuxedo对主机的内部逻辑命名。
#APPDIR要求放置SERVER的可执行文件。
#TUXCONFIG为全路径的二进制配置文件,要求和环境变量TUXCONFIG相同。
#TUXDIR为tuxedo安装目录,要求和环境变量TUXDIR相同。
CCBFJF85 LMID=simple
APPDIR="/home/tuxedo/samples/atmi/simpapp"
TUXCONFIG="/home/tuxedo/etc/tuxconfig"
TUXDIR="/home/tuxedo"
#MAXWSCLIENTS表示可连接client的最大个数。
MAXWSCLIENTS=50
*GROUPS
#GROUP1为组名,LMID表示该组运行的主机,GRPNO为组号,
#OPENINFO为该组打开数据库的初始串。
GROUP1 LMID=simple GRPNO=1 OPENINFO=NONE
*SERVERS
DEFAULT:
CLOPT="-A"
#WSL用于和client端进行连接。-n 表示出接入点为IP:PORT方式,
#-m -M 表示最小和最大启动多少个WSH和前端通讯,
#-x则表示一个WSH和几个client端连接。
WSL SRVGRP=GROUP1 SRVID=1
CLOPT="-A -- -n //127.0.0.1:8889-m 3 -M 10 -x 10 "
simpserv SRVGRP=GROUP1 SRVID=2
CLOPT="-A-o ./out.log -r -e ./err.log"
*SERVICES
touupers
10. simpcl.c文件的例子:
/* Copyright (c) 1997 BEA Systems, Inc.
All rights reserved
THIS IS UNPUBLISHED PROPRIETARY
SOURCE CODE OF BEA Systems, Inc.
The copyright notice above does not
evidence any actual or intended
publication of such source code.
*/
/* #ident"@(#) apps/simpapp/simpcl.c $Revision: 1.3 $" */
#include <stdio.h>
#include <stdlib.h>
#include "atmi.h" /* TUXEDOHeader File */
#if defined(__STDC__) || defined(__cplusplus)
main(int argc, char *argv[])
#else
main(argc, argv)
int argc;
char *argv[];
#endif
{
char *sendbuf, *rcvbuf;
long sendlen, rcvlen;
int ret;
if(argc != 2) {
(void) fprintf(stderr, "Usage: simpcl string\n");
exit(1);
}
/* Attach to System/T as a Client Process */
if (tpinit((TPINIT *) NULL) == -1) {
(void) fprintf(stderr, "Tpinit failed\n");
exit(1);
}
sendlen = strlen(argv[1]);
/* Allocate STRING buffers for the request and the reply */
if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
(void) fprintf(stderr,"Error allocating send buffer\n");
tpterm();
exit(1);
}
/*
if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
*/
if((rcvbuf = (char *) tpalloc("STRING", NULL, 1)) == NULL) {
(void) fprintf(stderr,"Error allocating receive buffer\n");
tpfree(sendbuf);
tpterm();
exit(1);
}
(void) strcpy(sendbuf, argv[1]);
/* Request the service TOUPPER, waiting for a reply */
ret = tpcall("touppers", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
if(ret == -1) {
(void) fprintf(stderr, "Can't send request to service TOUPPER\n");
(void) fprintf(stderr, "Tperrno = %d\n", tperrno);
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
exit(1);
}
(void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);
/* Free Buffers & Detach from System/T */
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
return(0);
}
11. simpserv.c文件的例子:
/* Copyright (c) 1997 BEA Systems, Inc.
All rights reserved
THIS IS UNPUBLISHED PROPRIETARY
SOURCE CODE OF BEA Systems, Inc.
The copyright notice above does not
evidence any actual or intended
publication of such source code.
*/
/* #ident"@(#) apps/simpapp/simpserv.c $Revision: 1.3 $" */
#include <stdio.h>
#include <ctype.h>
#include <atmi.h> /* TUXEDO Header File */
#include <userlog.h> /* TUXEDO Header File */
/* tpsvrinit is executed when a server is booted, before it begins
processing requests.It is not necessary to have this function.
Also available is tpsvrdone (not used in this example), which is
called at server shutdown time.
*/
#if defined(__STDC__) || defined(__cplusplus)
tpsvrinit(int argc, char *argv[])
#else
tpsvrinit(argc, argv)
int argc;
char **argv;
#endif
{
/* Some compilers warn if argc and argv aren't used. */
argc = argc;
argv = argv;
/* userlog writes to the central TUXEDO message log */
userlog("Welcome to the simple server");
return(0);
}
/* This function performs the actual service requested by the client.
Its argument is a structure containing among other things a pointer
to the data buffer, and the length of the data buffer.
*/
#ifdef __cplusplus
extern "C"
#endif
void
#if defined(__STDC__) || defined(__cplusplus)
touppers(TPSVCINFO *rqst)
#else
touppers(rqst)
TPSVCINFO *rqst;
#endif
{
int i;
for(i = 0; i < rqst->len-1; i++)
rqst->data[i] = toupper(rqst->data[i]);
/* Return the transformed buffer to the requestor. */
tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics