Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2981254
  • 博文数量: 412
  • 博客积分: 3010
  • 博客等级: 中校
  • 技术积分: 7374
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-25 15:15
个人简介

学习是一种信仰。

文章分类

全部博文(412)

文章存档

2014年(108)

2013年(250)

2010年(11)

2009年(43)

我的朋友

分类: 服务器与存储

2013-04-20 09:41:04

《Tuxedo中间件开发和管理培训》视频学习笔记(一)
----小布老师,08年5月
一、Introduction
1、Middleware目前流行叫做Application Server;
2、C语言编写;
3、Tuxedo走下坡路,因为BS架构流行;但CS仍有BS无法取代的使用场合;
4、Tuxedo server provides services to Tuxedo clients;
   ----server就是进程,用ps可以查看;
   ----services可以理解为一个一个的函数;
5、什么是短连接、长连接?
6、Bulletin Board Liaison(BBL:Tuxedo administration process);
7、客户端:native client,remote client;
8、unix命令:ipcs;
9、The tuxedo API:ATMI;
10、Tuxedo buffer types:
11、通讯方式:Request/Reply(synchronous、asynchronous);conversations;unsolicited messages;publish and subscribe;store and forward;
12、work distribution:
13、configuration and administration:centralized
14、domain:a tuxedo application;a bussiness progrem built upon the tuxedo system;
15、Conmand Line Utilities;GUI Administration Console;

二、Installing Tuxedo
1、Tuxedo Administrator
----职责同DBA,但更简单;
2、安装:官方安装文档;
3、目录结构;
4、卸载:卸载shell或删除全部目录;

三、Deploying a Basic Application
1、部署tuxedo自带例子,.../atmi/simpapp,小写转换大写;
2、部署步骤如下图:
    
(1)配置应用的环境变量
可以在tux.env中配置(临时环境变量):
> cat tux.env
TUXDIR=/opt/tuxedo/tuxedo11gR1; export TUXDIR
JAVA_HOME=$TUXDIR/jre; export JAVA_HOME
JVMLIBS=$JAVA_HOME/lib/amd64/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/tuxedo/simpapp; export APPDIR
TUXCONFIG=/home/tuxedo/simpapp/tuxconfig; export TUXCONFIG
里面的环境变量有些不是必须的,例如SHLIB_PATH用于HP-UX,LIBPATH用于IBM AIX,而LD_LIBRARY_PATH用于linux。
配置完之后执行:
> . ./tux.env
也可以在tuxedo用户的.profile中添加以上环境变量,是它们在进入tuxedo时自动生效
(2)配置ubbconfig,编译程序
先修改文本形式的ubbconfig:
vi ubbsimpapp
仅修改以下几个地方即可:
*RESOURCES
IPCKEY          123456
*MACHINES
DEFAULT:
                APPDIR="/home/tuxedo/simpapp"
                TUXCONFIG="/home/tuxedo/simpapp/tuxconfig"
                TUXDIR="/opt/tuxedo/tuxedo11gR1"
campost         LMID=simple
tuxedo需要二进制形式的ubbconfig,需要使用tmloadcf得到二进制的ubbconfig:
> tmloadcf -y ubbsimple
可以使用tmunloadcf命令从二进制形式的ubbconfig得到文本形式的ubbconfig。
编译服务端程序:
> buildserver -o simpserv -f simpserv.c -s TOUPPER
服务端程序及服务名不能任意命名,因为在配置文件中有配置。
编译客户端程序:
> buildserver -o simpserv -f simpserv.c -s TOUPPER
客户端可执行程序可任意命名。
(3)启动tuxedo应用,运行程序
> tmboot -y
Booting all admin and server processes in /home/tuxedo/simpapp/tuxconfig
INFO: Oracle Tuxedo, Version 11.1.1.3.0, 64-bit, Patch Level (none)
Booting admin processes ...
exec BBL -A :
        process id=22679 ... Started.
Booting server processes ...
exec simpserv -A :
        process id=22680 ... Started.
2 processes started.
> ./client "Hello, world"
Returned string is: HELLO, WORLD

四、Basic Tuxedo Configuration
1、tuxedo配置文件ubbxxx,既要文本文件,又要二进制文件,也是因为惯例,按说不应该必须让管理员手工tmloadcf生成二进制配置文件;
2、配置文件结构如下图:
     3、resource三个参数必不可少:
IPCKEY:IPC通信KEY,32,769—262,142,Tuxedo占用内存很少,该值尽量配大些;
MASTER:主Tuxedo节点的逻辑机器名(Logical Machine Name),与OS机器名(Real Machine Name,uname -a)映射,但不是OS机器名;
        Machine中有OS机器名与逻辑机器(LMID)名的对应。
MODEL:单机是SHM,多机网络是MP;
4、配置文件的联机文档为ads.pdf,其他参数调优时使用;

五、Administration and Additional Configuration
1、MIB:Management Information Base;
2、操作tuxedo有三种方式:(1)APIs;(2)tmadmin;(3)图形界面;
   对于学习来说,APIs用于开发,tmadmin用于管理,图形界面不用学习;
3、tmboot:
       如:tmboot -s dispApp;
4、tmshutdown:
        如:tmshutdown -s dispApp;
      tmshutdown -c;
5、tmadmin:

      :~> 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.
> help
aborttrans (abort) [-yes] [-g groupname [-R rmid]] tranindex
addmodule (amod) -g groupname -i srvid -n modulename -j jarfilename [-C localclasspath] [-A args]
advertise (adv) {-q qaddress [-g groupname] [-i srvid] | -g groupname -i srvid} service[:func]
bbclean (bbc) machine
bbinternals (bbi)
bbparms (bbp)
bbsread (bbls) machine
bbstats (bbs)
boot (b) [options]
broadcast (bcst) [-m machine] [-u usrname] [-c cltname] [text]
changeload (chl) [-m machine] {-q qaddress [-g groupname] [-i srvid]
        [-s service] | -g groupname -i srvid -s service | -I interface [-g groupname]} newload
changemodule (cmod) -g groupname -i srvid -n modulename -j jarfilename [-C localclasspath] [-A args]
changepriority (chp) [-m machine] {-q qaddress [-g groupname] [-i srvid]
        [-s service] | -g groupname -i srvid -s service | -I interface [-g groupname]} newpri
changetrace (chtr) [-m machine] [-g groupname [-R rmid]] [-i srvid] newspec
changetrantime (chtt) [-m machine] {-q qaddress [-g groupname] [-i srvid]
        [-s service] | -g groupname -i srvid -s service | -I interface [-g groupname]} newtlim
committrans (commit) [-yes] -g groupname [-R rmid] tranindex
config (conf)
crdl (crdl) -b blocks -z config -o configoffset [-O newdefoffset] [newdevice]
crlog (crlg) -m machine
default (d) [-c clientname] [-g groupname] [-i srvid] [-m machine]
        [-q qaddress] [-s service] [-u username]
        [-b blocks] [-o offset] [-z config] [-a {0|1|2}]
        [-I interface] [-B objectid] [-r routingname]
        [-p jdbcconnpool]
dsdl (dsdl) [-yes] -z config [-o offset] dlindex
dslog (dslg) [-yes] -m machine
dump (du) fname
dumpmem (dumem) fname
dumptlog (dl) -z config [-o offset] [-n name] [-g groupname [-R rmid]] filename
echo (e) [{off | on}]
help (h) [{command | all}]
initdl (indl) [-yes] -z config [-o offset] dlindex
inlog (inlog) [-yes] -m machine
interfaceparms (ifp) -g groupname -I interface
lidl (lidl) -z config [-o offset] [dlindex]
livtoc (livtoc) -z config [-o offset]
loadtlog (loadtlog) -m machine filename
logstart (logstart) machine
migrategroup (migg) [-cancel] group_name
migratemach (migm) [-cancel] machine
mode (mode) {-g groupname | -i srvid | -q qaddress} ... [command [arguments]]
paginate (page) [{off | on}]
passwd (passwd)
pclean (pcl) machine
printactiveobject (pao) [-B objectid] [-m machine]
printclient (pclt) [-m machine] [-u usrname] [-c cltname]
printconn (pc) [-m machine]
printdomain (pd) [{-g groupname | -i srvid | -q qaddress} ...]
printfactory (pf)
printgroup (pg) [-m machine] [-g groupname]
printinterface (pif) [-m machine] [-g groupname] [-I interface]
printjdbcconnpool (pjcp) [-g groupname] [-i srvid] [-p jdbcconnpoolname]
printmodule (pmod) [-g groupname] [-i srvid]
printnet (pnw) [mach_list]
printqueue (pq) [qaddress]
printroute (pr) [-r routingname]
printserver (psr) [-m machine] [-g groupname [-R rmid]] [-i srvid] [-q qaddress]
printservice (psc) [-m machine] [-g groupname [-R rmid]] [-i srvid] [-q qaddress] [-s service] [-a {0|1|2}]
printtrans (pt) [-g groupname [-R rmid]] [-m machine]
quit (q)
reconnect (rco) non-partitioned_machine1 partitioned_machine2
reconnectdomain (rd) {-g groupname | -i srvid | -q qaddress} ...
removemodule (rmod) -g groupname -i srvid -n modulename
resume (res) {-q qaddress | -g groupname | -i srvid | -s service | -I interface} ...
serverparms (srp) -g groupname [-R rmid] -i srvid
serviceparms (scp) -g groupname -i srvid -s service
shmstats (sstats) [{ex | app}]
shutdown (stop) [options]
stats (stats) {-g groupname | -i srvid | -q qaddress} ... [-s service]
stoptlisten (stoptl) [-m machine]
suspend (susp) {-q qaddress | -g groupname | -i srvid | -s service |-I interface} ...
unadvertise (unadv) {-q qaddress [-g groupname] [-i srvid] | -g groupname -i srvid} service
verbose (v) [{off | on}]
printrm (prm) [-m machine] [-g group]
>
6、tuxedo tmadmin和oracle sqlplus输入错误按回退键无法删除,出现“^H”,用delete键才能删除:
设置回退键有效命令:stty erase ^H,但此时delete键又无效了;
7、一些其他命令:

    
如:
> pclt
    LMID         User Name       Client Name    Time    Status  Bgn/Cmmt/Abrt
--------------- --------------- --------------- -------- ------- -------------
Africa          production      WSH             46:01:11 IDLE    0/0/0
Africa          production      WSH             46:01:11 IDLE    0/0/0
......
Africa          DATA_SYNC_LIST+ 052002          24:22:02 IDLE/W  0/0/0
Africa          DATA_SYNC_LIST+ 052002          24:22:02 IDLE/W  0/0/0
Africa          DATA_SYNC_LIST+ 052001          24:22:01 IDLE/W  0/0/0
Africa          DATA_SYNC_LIST+ 053001          24:22:02 IDLE/W  0/0/0
Africa          DATA_SYNC_LIST+ 053000          23:20:11 IDLE/W  0/0/0
Africa          DATA_SYNC_LIST+ 023001          24:22:02 IDLE/W  0/0/0
Africa          DATA_SYNC_LIST+ 022001          23:20:12 IDLE/W  0/0/0
Africa          DATA_SYNC_LIST+ 023000          24:22:02 IDLE/W  0/0/0
Africa          DATA_SYNC_LIST+ 022000          24:22:01 IDLE/W  0/0/0
Africa          DATA_SYNC_LIST+ 052000          23:20:12 IDLE/W  0/0/0
Africa          production      tmadmin          0:18:10 IDLE    0/0/0
8、常用参数配置
     

如下为一个tuxedo应用的配置文件ubbproduction:
> vi ubb_production
*RESOURCES
IPCKEY          237456
DOMAINID        camp_production
MASTER          Africa
MAXACCESSERS    2000
MAXSERVERS      200
MAXSERVICES     600
MODEL           SHM
LDBAL           N
BLOCKTIME       80
NOTIFY          SIGNAL
USIGNAL         SIGUSR1
*MACHINES
DEFAULT:
        APPDIR="/home/production/cpst/campost/bin"
        TUXCONFIG="/home/production/cpst/campost/config/tuxconfig"
        ULOGPFX="/home/production/cpst/campost/logs/ULOG"
        TUXDIR="/home/production/tuxedo"
        MAXWSCLIENTS=600
#identify "@(#) config/ubb $Revision: 1.1$"
*RESOURCES
IPCKEY          237456
DOMAINID        camp_production
MASTER          Africa
MAXACCESSERS    2000
MAXSERVERS      200
MAXSERVICES     600
MODEL           SHM
LDBAL           N
BLOCKTIME       80
NOTIFY          SIGNAL
USIGNAL         SIGUSR1
*MACHINES
DEFAULT:
        APPDIR="/home/production/cpst/campost/bin"
        TUXCONFIG="/home/production/cpst/campost/config/tuxconfig"
        ULOGPFX="/home/production/cpst/campost/logs/ULOG"
        TUXDIR="/home/production/tuxedo"
        MAXWSCLIENTS=600
#"Africa.site"  LMID="Africa"
"campost"       LMID="Africa"
*GROUPS
"GROUP1"        LMID="Africa"   GRPNO=1 OPENINFO=NONE
"GROUP2"        LMID="Africa"   GRPNO=2 OPENINFO=NONE
*SERVERS
DEFAULT:
        CLOPT="-A"
#应用服务组
dispApp SRVGRP=GROUP1 SRVID=1 RESTART=Y MIN=1 MAX=10 MAXGEN=2 CLOPT="-A -- a on -t on"
acpApp  SRVGRP=GROUP1 SRVID=11 RESTART=Y MIN=1 MAX=10 MAXGEN=2 CLOPT="-A -- a on -t on"
dlvApp  SRVGRP=GROUP1 SRVID=21 RESTART=Y MIN=1 MAX=10 MAXGEN=2 CLOPT="-A -- a on -t on"
broadcastApp    SRVGRP=GROUP1 SRVID=31 RESTART=Y MIN=1 MAX=10 MAXGEN=2 CLOPT="-A -- a on -t on"
downloadApp     SRVGRP=GROUP1 SRVID=41 RESTART=Y MIN=1 MAX=10 MAXGEN=2 CLOPT="-A -- a on -t on"
transferApp     SRVGRP=GROUP1 SRVID=51 RESTART=Y MIN=1 MAX=10 MAXGEN=2 CLOPT="-A -- a on -t on"
emailApp        SRVGRP=GROUP1 SRVID=61 RESTART=Y MIN=1 MAX=10 MAXGEN=2 CLOPT="-A -- a on -t on"
#domain管理的服务组
DMADM   SRVGRP=GROUP2 SRVID=1
GWADM   SRVGRP=GROUP2 SRVID=2
GWTDOMAIN SRVGRP=GROUP2 SRVID=3 REPLYQ=Y
#WSL    SRVGRP=GROUP2 SRVID=4 CLOPT="-A -- -n //132.10.10.11:9600 -T 20 -N 300 -m 50 -M 100 -x 2 -c 1024 -p 40000 -P 41000"
WSL     SRVGRP=GROUP2 SRVID=4 CLOPT="-A -- -n //132.10.10.17:9600 -T 20 -N 300 -m 50 -M 100 -x 2 -c 1024 -p 40000 -P 41000"
*SERVICES
ServiceDisp
ServiceAcp
ServiceDlv
ServiceDownload
ServiceBroadcast
ServiceTransfer
ServiceEmail
>
说明:
CLOPT:“--”符左边是服务参数,“-A”是服务全部启动,“--”符右边是要传给客户端的参数,“-t on”是支持多线程;
MIN:最少启动服务数;
MAX:最多启动服务数;较好的方法是把MIN和MAX设置相等,把所有服务全启动,因为现在服务器内存已不是系统瓶颈了;
-p:允许设置MIN和MAX;
LDBAL:是否启动load balance功能;如果启动了load balance功能,services可以设置负载因子和优先级参数;
9、ULOG:User LOG file
默认放在APPDIR下,可以在resource中加参数ULOGPFX参数指定其他目录;
出现错误,分析ULOG时,一般先分析第一个错误,因为后面很多错误都可能是第一个错误导致的;
10、tmtrace:分析atmi系统调用的详细信息
export tmtrace=on之后在ULOG中查看详细信息,在开发时使用,因为要写大量的日志;
     

11、tmshutdown多次不能关掉时:
kill -9
rpcm

阅读(5737) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~