tuxedo: 集群配置要点

 tuxedo诱人之处就是他的身份:中间件。而集群配置是发挥中间件作用的基础,本文简要描述一个集群框架;

(一)集群概要图

下图是tuxedo集群的概要描述,很多教材都引用了这幅图:

有几点需要注意:

1、TUXCONFIG:TUXCONFIG文件只在Master主机上进行编译,其他主机(称该类主机为-从主机)不要编译,在初始时候,其他主机应该是没有该文件的,该文件是在Master发出tmboot启动的时候通过bridge链接将TUXCONFIG文件copy到各个从主机上;

2、DBBL:Master主机上有独立进程DBBL,负责管理集群中所有主-从主机上的BBL进程,主要是实时监测BBL中服务列表的状况,找到某台主机上的服务也是通过DBBL进程定位的;

3、BRIDGE:主-从主机是通过bridge进程进行网络通信的,常用的是tcp协议进行通信;

4、TLISTEN:主-从主机都需要在集群启动之前,启动tlisten监听程序,目的是监听连接请求,当某台主机tlisten进程监测到连接请求时,受理请求移交给bridge进程处理,然后继续监听,所以bridge是真正干活的;Master主机配tlisten其实是便于以后Master主机间的切换:即Master变为从主机,另一台从主机变为Master主机。tuxedo支持这种切换;

5、APPLICATION:不同的主机可以有不同的server及service,当然可以相同;

 

(二)TUXCONFIG文件

文本文件内容应该大体如下(假设只有Master和一台从主机,共两个主机组成的集群):

为了解释方便直接在代码中注释,如编译需要删除注释;

*RESOURCES
IPCKEY          55433
MASTER          SITE1,SITE2//site2为备用Master,site1宕机了site2顶替
MODEL           MP//模式是multiple machine
OPTIONS         LAN//置为lan,这和MP配对使用

*MACHINES
"centos"//master主机名
                LMID=SITE1
                TUXDIR="/home/tuxedo/tuxedo11gR1"
                APPDIR="/home/tuxedo/studylabA11/exercises/mmc"
                TUXCONFIG="/home/tuxedo/studylabA11/exercises/mmc/tuxconfig"
                UID=502//centos tuxedo管理员用户的UID
                GID=504//centos tuxedo管理员用户的GID

"node2"//从主机主机名
                LMID=SITE2
                TUXDIR="/home/tuxedo/tuxedo11gR1"
                APPDIR="/home/tuxedo/studylabA11/exercises/mmc"
                TUXCONFIG="/home/tuxedo/studylabA11/exercises/mmc/tuxconfig"
                UID=501//node2上面tuxedo管理员的UID
                GID=501//node2上面tuxedo管理员的GID

*GROUPS
APPGRP1
                LMID=SITE1
                GRPNO=1
APPGRP2
                LMID=SITE2
                GRPNO=2

*NETWORK//配置集群不可少的网络配置
SITE1
                NADDR="//192.168.102.100:9003"//bridge进程使用的网络地址及端口
                NLSADDR="//192.168.102.100:3050"//tlisten进程使用的网络地址及端口

SITE2
                NADDR="//192.168.102.101:9004"
                NLSADDR="//192.168.102.101:3051"
*SERVERS
serverping
                SRVID=10
                SRVGRP=APPGRP1
                CLOPT="-A"
serverping
                SRVID=20
                SRVGRP=APPGRP2
                CLOPT="-A"

执行tmloadcf命令编译,这样tuxconfig文件完成了

 

(三)启动tuxedo集群

在启动之前需要执行一下步骤:

1、启动tlisten进程:在全部主机上执行tlisten监听进程,如centos> tlisten -l //192.168.102.100:3050     node2> tlisten -l //192.168.102.101:3051 注意端口和ip和上面tuxconfig中要一致;

2、准备好tuxconfig指定的server app软件;这个。。。就不多说了,不能没有服务;

3、tmboot启动集群即可;

检验下执行结果

centos上:

[tuxedo@centos mmc]$ tlisten -l //192.168.102.100:3050
[tuxedo@centos mmc]$ ps -ef | grep tuxedo
root      1728  1705  0 09:59 pts/0    00:00:00 su tuxedo
tuxedo    1731  1728  0 09:59 pts/0    00:00:00 bash
tuxedo    2312     1  0 12:24 pts/0    00:00:00 tlisten -l //192.168.102.100:3050
tuxedo    2313  1731  1 12:24 pts/0    00:00:00 ps -ef
tuxedo    2314  1731  0 12:24 pts/0    00:00:00 grep tuxedo
[tuxedo@centos mmc]$ tmboot
Boot all admin and server processes? (y/n): y
Booting all admin and server processes in /home/tuxedo/studylabA11/exercises/mmc/tuxconfig
INFO: Oracle Tuxedo, Version 11.1.1.2.0, 64-bit, Patch Level (none)

Booting admin processes ...

exec DBBL -A :
        on SITE1 -> process id=2316 ... Started.
exec BBL -A :
        on SITE1 -> process id=2317 ... Started.
exec BBL -A :
        on SITE2 -> process id=2443 ... Started.

Booting server processes ...

exec serverping -A :
        on SITE1 -> process id=2321 ... Started.
exec serverping -A :
        on SITE2 -> process id=2445 ... Started.
5 processes started.
[tuxedo@centos mmc]$ 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.

> psr
Prog Name      Queue Name  Grp Name      ID RqDone Load Done Current Service
---------      ----------  --------      -- ------ --------- ---------------
BBL            30003.00000 SITE2          0      -         - ( - )
BBL            30002.00000 SITE1          0      -         - ..TMIB0
DBBL           55433       SITE1          0     27      1350 ..MASTERBB
BRIDGE         579721      SITE2          1      -         - ( - )
BRIDGE         317577      SITE1          1      -         - ( - )
serverping     00001.00010 APPGRP1       10      -         - ( - )
serverping     00002.00020 APPGRP2       20      -         - ( - )

> psc
Service Name Routine Name Prog Name  Grp Name  ID    Machine  # Done Status
------------ ------------ ---------  --------  --    -------  ------ ------
PING         PING         serverping APPGR+    10      SITE1       - AVAIL
PING         PING         serverping APPGR+    20      SITE2       - AVAIL

> 
[tuxedo@centos mmc]$ ps -ef | grep tuxedo
root      1728  1705  0 09:59 pts/0    00:00:00 su tuxedo
tuxedo    1731  1728  0 09:59 pts/0    00:00:00 bash
tuxedo    2312     1  0 12:24 pts/0    00:00:00 tlisten -l //192.168.102.100:3050
tuxedo    2316     1  0 12:24 pts/0    00:00:00 DBBL -g 30001 -i 0 -u centos -U /home/tuxedo/studylabA11/exercises/mmc/ULOG -m 0 -A
tuxedo    2317     1  0 12:24 pts/0    00:00:00 BBL -g 30002 -i 0 -u centos -U /home/tuxedo/studylabA11/exercises/mmc/ULOG -m 0 -A
tuxedo    2318     1  0 12:24 pts/0    00:00:00 BRIDGE -g 30002 -i 1 -u centos -U /home/tuxedo/studylabA11/exercises/mmc/ULOG -m 0 -A
tuxedo    2321     1  0 12:24 pts/0    00:00:00 serverping -g 1 -i 10 -u centos -U /home/tuxedo/studylabA11/exercises/mmc/ULOG -m 0 -A
tuxedo    2332  1731  0 12:28 pts/0    00:00:00 ps -ef
tuxedo    2333  1731  0 12:28 pts/0    00:00:00 grep tuxedo
[tuxedo@centos mmc]$ 

 

node2上:

[tuxedo@node2 mmc]$ ps -ef | grep tuxedo
root      1614  1591  0 09:06 pts/0    00:00:00 su tuxedo
tuxedo    1617  1614  0 09:07 pts/0    00:00:00 bash
root      1861  1637  0 09:24 pts/0    00:00:00 su tuxedo
tuxedo    1865  1861  0 09:24 pts/0    00:00:00 bash
tuxedo    2431     1  0 11:48 pts/0    00:00:00 tlisten -l //192.168.102.101:3051
tuxedo    2443  2431  0 11:50 pts/0    00:00:00 BBL -g 30003 -i 0 -u node2 -U /home/tuxedo/studylabA11/exercises/mmc/ULOG -m 65537 -A
tuxedo    2444  2431  0 11:50 pts/0    00:00:00 BRIDGE -g 30003 -i 1 -u node2 -U /home/tuxedo/studylabA11/exercises/mmc/ULOG -m 65537 -A
tuxedo    2445  2431  0 11:50 pts/0    00:00:00 serverping -g 2 -i 20 -u node2 -U /home/tuxedo/studylabA11/exercises/mmc/ULOG -m 65537 -A
tuxedo    2452  1865  1 11:53 pts/0    00:00:00 ps -ef
tuxedo    2453  1865  0 11:53 pts/0    00:00:00 grep tuxedo
[tuxedo@node2 mmc]$ 

结果里面关注几个重要进程:DBBL、BBL、BRIDGE、tlisten、serverping;

这样集群就跑起来了,这时就可以用客户端调用了,如果客户端没有在这两台主机上,还需要配置WSL进程;若客户端在集群中的主机上,那么就无需配置WSL了,直接就可以调用服务,并且会就近访问,这得益于tuxconfig文件的分发机制!看测试结果:

在centos上运行客户端(一个ping 的程序,返回调用主机的信息):

[tuxedo@centos mmc]$ ./clientping 
Result of PING request is: 
LMID = SITE1, Group = APPGRP1, Server ID = 10, Process ID = 2321
Result of PING request is: 
LMID = SITE1, Group = APPGRP1, Server ID = 10, Process ID = 2321
Result of PING request is: 
LMID = SITE1, Group = APPGRP1, Server ID = 10, Process ID = 2321
Result of PING request is: 
LMID = SITE1, Group = APPGRP1, Server ID = 10, Process ID = 2321
Result of PING request is: 
LMID = SITE1, Group = APPGRP1, Server ID = 10, Process ID = 2321

在node2上运行客户端

[tuxedo@node2 mmc]$ ./clientping 
Result of PING request is: 
LMID = SITE2, Group = APPGRP2, Server ID = 20, Process ID = 2445
Result of PING request is: 
LMID = SITE2, Group = APPGRP2, Server ID = 20, Process ID = 2445
Result of PING request is: 
LMID = SITE2, Group = APPGRP2, Server ID = 20, Process ID = 2445
Result of PING request is: 
LMID = SITE2, Group = APPGRP2, Server ID = 20, Process ID = 2445
Result of PING request is: 
LMID = SITE2, Group = APPGRP2, Server ID = 20, Process ID = 2445

如有疑问,请留言讨论;

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值