TUXEDO简介及命令介绍
Tuxedo是一个客户机/服务器的―中间件‖产品,它在客户机和服务器之间进行调节,以保证正确地处理事务。Tuxedo是一个事务处理(TP)监督器,它管理联机事务处理(OLTP)系统(参见―事务处理‖)操作的事务。客户通过结构化查询语言(SQL)调用,或其它类型的请求,产生对服务器的请求。这个事务处理监督器确信,正确地进行了修改,以保证数据的完整性。这在一个事务可以改变多个位置的数据库的分布式数据库环境是非常重要的。这个事务处理监督器使用双阶段提交,以保证所有的数据库都已经接收和认可了这些数据的正确性。否则,这个数据库返回它的事务前状态。 事务监督器从前都是与大的大型计算机系统联系在一起的,但是Tuxedo的设计是为了在不昂贵的基于UNIX的系统上运行。AT&T最初是作为它自己使用的联机事务处理开发Tuxedo的。虽然Tuxedo必须在U-NIX系统上运行,但是它可以与DOS、OS/2、Windows和UNIX客户一起工作。它还使用通用的通信协议,如传输控制协议/因特网协议(TCP/IP)和网络基本输入输出系统(NetBIOS),并且可以在这些环境提供分布式处理支持。例如,它可以根据请求的类型,服务请求从一个客户选择路由到一个特定的服务器。Tuxedo的基本特征是它的联机事务处理系统,但是,Tuxedo也工作于集成关系型的平面文件,以及层次数据库系统。
相关条目:Connectionless and Connection-Oriented Transactions无连接和面向连接事务;Transaction Processing 事务处理。
Tuxedo作为电子商务交易平台,它允许客户机和服务器参与一个涉及多个数据库协调更新的交易,
并能够确保数据的完整性。BEA Tuxedo一个特色功能是能够保证对电子商务应用系统的不间断访问。
它可以对系统组件进行持续的监视,查看是否有应用系统、交易、网络及硬件的故障。
一旦出现故障,BEA Tuxedo会从逻辑上把故障组件排除,然后进行必要的恢复性步骤。
BEA Tuxedo根据系统的负载指示,自动开启和关闭应用服务,可以均衡所有可用系统的负载,
以满足对应用系统的高强度使用需求。借助DDR(数据依赖路由), BEA Tuxedo可按照消息的上下文来选择消息路由。其交易队列功能, 可使分布式应用系统以异步―少连接‖方式协同工作。
BEA Tuxedo LLE安全机制可确保用户数据的保密性,
应用/交易管理接口(ATMI)为50多种硬件平台和操作系统提供了一致的应用编程接口。
BEA Tuxedo基于网络的图形界面管理可以简化对电子商务的管理,
为建立和部署电子商务应用系统提供了端到端的电子商务交易平台。
Tuxedo使用
————Tuxedo配置及简单应用
1. 设置环境变量
TUXDIR=
APPDIR=
PATH=
TUXCONFIG=
WSNADDR=
LD_LIBRARY_PATH=%LD_LIBRARY_PATH%;%TUXDIR%\LIB
2. 编辑样本配置文件ubbsimple,修改相应内容。
IPCKEY 区别于其他用户的变量(32767..262143)
TUXCONFIG
TUXDIR
APPDIR
Machine-name
3. 使用如下命令建立二进制配置文件:
tmloadcf
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 启动/关闭某个server id指定的Server进程
-g grpname 启动/关闭某个server group名字指定的Server Group
-S 启动/关闭所有应用服务器(LMID)
-s server-name 启动/关闭某个server名字指定的Server进程
-l lmid option 在指定的机器上启动/关闭所有TMS进程和应用服务器(LMID) -T grpname 启动/关闭指定的server group中所有的TMS进程
-B lmid 在指定的机器上启动/关闭BBL进程
-e command 指定一个程序可以当在MASTER机器上启动任何一个进程失败时执行 -c 计算出当前UBB配置的Tuxedo启动最少要占用的系统IPC资源
9. UBBCONFIG文件的例子:
#ident
#Skeleton UBBCONFIG file for the TUXEDO Simple Application.
#Replace the 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=
TUXCONFIG=
TUXDIR=
#MAXWSCLIENTS表示可连接client的最大个数。
MAXWSCLIENTS=50
*GROUPS
#GROUP1为组名,LMID表示该组运行的主机,GRPNO为组号,
#OPENINFO为该组打开数据库的初始串。
GROUP1 LMID=simple GRPNO=1 OPENINFO=NONE
*SERVERS
DEFAULT:
CLOPT=
#WSL用于和client端进行连接。-n 表示出接入点为IP:PORT方式,
#-m -M 表示最小和最大启动多少个WSH和前端通讯,
#-x则表示一个WSH和几个client端连接。
WSL SRVGRP=GROUP1 SRVID=1
CLOPT=
simpserv SRVGRP=GROUP1 SRVID=2
CLOPT=
*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
#include
#include
#include
#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,
exit(1);
}
/* Attach to System/T as a Client Process */
if (tpinit((TPINIT *) NULL) == -1) {
(void) fprintf(stderr,
exit(1);
}
sendlen = strlen(argv[1]);
/* Allocate STRING buffers for the request and the reply */
if((sendbuf = (char *) tpalloc(
(void) fprintf(stderr,
tpterm();
exit(1);
}
/*
if((rcvbuf = (char *) tpalloc(
*/
if((rcvbuf = (char *) tpalloc(
(void) fprintf(stderr,
tpfree(sendbuf);
tpterm();
exit(1);
}
(void) strcpy(sendbuf, argv[1]);
/* Request the service TOUPPER, waiting for a reply */
ret = tpcall(
if(ret == -1) {
(void) fprintf(stderr,
(void) fprintf(stderr,
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
exit(1);
}
(void) fprintf(stdout,
/* 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
#include
#include
#include /* TUXEDO Header File */
#include /* 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(
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
#endif
void
#if defined(__STDC__) || defined(__cplusplus)
touppers(TPSVCINFO *rqst)
#else
touppers(rqst)
TPSVCINFO *rqst;
#endif
{
int i;
for(i = 0; i len-1; i++)
rqst->data[i] = toupper(rqst->data[i]);
/* Return the transformed buffer to the requestor. */
tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}