Trafodion 工具之dtmci

我们知道Trafodion是一款分布式的SQL on Hadoop的SQL引擎,底层基于HBase。Trafodion是一款Hadoop之上的HTAP型数据库,即同时支持事务型及分析型的场景于一体的数据库。其中,事务型场景主要基于底层HBase,因为HBase是一款Key-Value式数据库,特别适合于大数据量的随机读写;而分析型场景一般会基于Hive,Trafodion可以直接访问原生的Hive表,通过Trafodion自身的SQL引擎访问Hive表,可以直接绕过Hive本身通过Map Reduce走批量计算,从而大大提升了查询性能。

就事务型而言,Trafodion不但可以支持高性能的随机读写,而且支持“事务”。Trafodion中的“事务”保证通过TM实现,TM即Transaction Manager(事务管理器),Trafodion中的事务管理器是在每个Trafodion节点上有一个TM进程,因此我们又称之为DTM(分布式事务管理器),而其他很多的NoSQL数据库通常是采用单个事务管理服务器。关于Trafodion的事务管理器的介绍,我们会在后续文章单独介绍,本文我们主要介绍Trafodion自带的一个用于监控管理事务的工具dtmci。

dtmci是Trafodion提供的一款用于监视事务管理器的可执行工具,通过dtmci工具可以很容易地获取事务管理器的更详细的信息以及一些操作配置,主要功能包括:

  • 获取TM的信息
  • 获取事务(transactions)的信息
  • TM统计分析数据
  • 关闭事务

在任意一个Trafodion节点通过trafodion用户执行dtmci可以打开dtmci交互式客户端,输入”h”查看支持的命令及功能,

[trafodion@esg-n002 ~]$ dtmci
DTM Command line interface. v 3.1.0, Nov 26, 2014
DTMCI > h
DTM Command line interface. v 3.1.0, Nov 26, 2014 Help:
 a | abort 
        : Will abort the current transaction.
 b | begin 
        : Will begin a transaction and display the tag
 disable trans[actions] [, shutdown normal|immediate] 
        : Disable transaction processing in DTM.
        : shutdown is only provided for testing and should
        : not be used.  Use sqstop instead.
 drain <nid> [, immediate]  
        : Drain transactions from a node.
        : This is similar to disable but affects
        : only one node.
        : Immediately causes all active transactions
        : in the node to be aborted.
 end | commit 
        : Will end the current transaction
 enable trans[actions] 
        : Enable transaction processing in DTM.
 l | list [<nid>] 
        : Will list all transactions and their status for 
        : node <nid> or all nodes if none specified.
 r | t | resume [<tag>]
        : Will suspend the current transaction if no tag is supplied.
        : if tag is specified it will resume work on the given tag
 s | stats [<nid> | [reset] -j]
        : Will list the current TM statistics
        : If reset is specified, reset statistics after 
        : displaying them.
 status system
        : Prints system TM information
 status tm [<nid>] [rmid] -j
        : Status of the TM in node <nid>.  Returns TM information 
        : for all nodes if none specified.  Specifying a node gives 
        : RM details.
        : <rmid> option sorts by rmid, default is sort by rm name.
 status trans[action] [transid]
        : Status of the specified transaction.
        : transid may be in numeric or <node>,<sequence> format.
 status regions
        : Status of the transactions on the hbase regions - client side
 transid [string] <transid>
        : Prints transaction ID information
        : Entering string option outputs (node, sequence, incarn #)
 h | ? | help
        : Display this help.
 q | quit | exit
        : Exit dtmci

下面是一些常用命令及样例输出,

//列出当前所有的事务及状态
DTMCI > list
Node 0 : No Transactions were returned.
(cid,nid,xid)   Owner   Full_Transid            State
(0,1,21)        1,1670  4294967317              ACTIVE
Node 2 : No Transactions were returned.
//数据库系统的整体TM状态
DTMCI > status system
Lead    Up      Down    Recov   Total   Active Txs
0       3       0       0       3       1
//数据库每个TM状态
DTMCI > status tm
Node    LeadTM  State   SysRec  ShutdownLevel   Incarn  Txns    IsolTM  RMs
0       true    UP      END     RUNNING         0       0       false   0
1       false   UP      END     RUNNING         0       1       false   0
2       false   UP      END     RUNNING         0       0       false   0
//每个事务的详细信息
DTMCI > status trans
Node 0 : No Transactions were returned.
Transid         Owner   Full_Transid    Joins   Elapsed(sec)    State      Timestamp
(0,1,21)        1,1670  4294967317      0       663             ACTIVE  Tue Jan 23 09:41:50 2018
Node 2 : No Transactions were returned.
//整体集群的事务详情
DTMCI > stats
Node 0:
  Counts: Total = 11, Current = 0, Begins = 11, Aborts = 3, Commits = 8, TM Aborts = 2, Hung total = 0, current = 0
  Txns  Total 11(11.190+-17.988s)       Begins 11(0.001+-0.002s)
        Aborts 1(0.164+-0.000s) Commits 8(1.814+-3.193s)
  XA    start 11(0.000+-0.000s) end 11(0.000+-0.000s)
        prepare 8(0.000+-0.000s)        ax_reg 0(0.000+-0.000s)
        commit 5(0.000+-0.000s) rollback 3(0.000+-0.000s)
  RM    Sends 38(0.000+-0.000s) Partic 0         Non-partic 0
  Txn Pool:     Inuse 0 Free 5  SSLow 5 SSHigh 1000     Max 5000
   Allocs:      new 5(0/sec)    frees 6(0/sec)
   Deallocs:    frees 11(0/sec) deletes 0(0/sec)
  Thrd Pool:    Inuse 0 Free 1  SSLow 1 SSHigh 100      Max 100
   Allocs:      new 1(0/sec)    frees 66(0/sec)
   Deallocs:    frees 67(0/sec) deletes 0(0/sec)
  RMMsg Pool:   Inuse 0 Free 0  SSLow 10        SSHigh 10000    Max 10000
   Allocs:      new 0(0/sec)    frees 0(0/sec)
   Deallocs:    frees 0(0/sec)  deletes 0(0/sec)
,Node 1:
  Counts: Total = 21, Current = 1, Begins = 21, Aborts = 3, Commits = 17, TM Aborts = 0, Hung total = 0, current = 0
  Txns  Total 20(363.592+-1568.428s)    Begins 20(0.001+-0.002s)
        Aborts 3(0.030+-0.002s) Commits 17(1.037+-2.100s)
  XA    start 20(0.000+-0.000s) end 20(0.000+-0.000s)
        prepare 17(0.000+-0.000s)       ax_reg 0(0.000+-0.000s)
        commit 16(0.000+-0.000s)        rollback 3(0.000+-0.000s)
  RM    Sends 76(0.000+-0.000s) Partic 0         Non-partic 0
  Txn Pool:     Inuse 1 Free 4  SSLow 5 SSHigh 1000     Max 5000
   Allocs:      new 5(0/sec)    frees 16(0/sec)
   Deallocs:    frees 20(0/sec) deletes 0(0/sec)
  Thrd Pool:    Inuse 0 Free 1  SSLow 1 SSHigh 100      Max 100
   Allocs:      new 1(0/sec)    frees 155(0/sec)
   Deallocs:    frees 156(0/sec)        deletes 0(0/sec)
  RMMsg Pool:   Inuse 0 Free 0  SSLow 10        SSHigh 10000    Max 10000
   Allocs:      new 0(0/sec)    frees 0(0/sec)
   Deallocs:    frees 0(0/sec)  deletes 0(0/sec)
,Node 2:
  Counts: Total = 12, Current = 0, Begins = 12, Aborts = 2, Commits = 10, TM Aborts = 0, Hung total = 0, current = 0
  Txns  Total 12(5.096+-4.410s) Begins 12(0.001+-0.001s)
        Aborts 2(0.014+-0.004s) Commits 10(1.709+-2.531s)
  XA    start 12(0.000+-0.000s) end 12(0.000+-0.000s)
        prepare 10(0.000+-0.000s)       ax_reg 0(0.000+-0.000s)
        commit 10(0.000+-0.000s)        rollback 2(0.000+-0.000s)
  RM    Sends 46(0.000+-0.000s) Partic 0         Non-partic 0
  Txn Pool:     Inuse 0 Free 5  SSLow 5 SSHigh 1000     Max 5000
   Allocs:      new 5(0/sec)    frees 7(0/sec)
   Deallocs:    frees 12(0/sec) deletes 0(0/sec)
  Thrd Pool:    Inuse 0 Free 1  SSLow 1 SSHigh 100      Max 100
   Allocs:      new 1(0/sec)    frees 115(0/sec)
   Deallocs:    frees 116(0/sec)        deletes 0(0/sec)
  RMMsg Pool:   Inuse 0 Free 0  SSLow 10        SSHigh 10000    Max 10000
   Allocs:      new 0(0/sec)    frees 0(0/sec)
   Deallocs:    frees 0(0/sec)  deletes 0(0/sec)
//具体某个transaction id的详情
DTMCI > transid 4294967317
Transid         Node    Seq #    Incarn    TX Flags    TT Flags
(1,0,21)        0       21       0         0x0         0x0     
Version    Checksum          Timestamp
1          403           1516671710735
//关闭事务功能
DTMCI > disable trans
//启用事务功能
DTMCI > enable trans
//查看当前有哪些region上有事务
DTMCI > status regions
No Regions Returned from HBASETM_REQUESTREGIONINFO

注:
使用”disable trans”表示关闭事务功能,关闭之后系统将无法开启一个事务,如执行begin命令将会报错,

SQL>begin;

*** ERROR[8604] Transaction subsystem TMF returned error 86 while starting a transaction. [2018-01-23 10:02:00]

此时只有使用”enable trans”重启开启事务功能,才可以恢复开启事务的功能,

SQL>begin;

--- SQL operation complete.
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

数据源的港湾

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值