数据库性能工具

sdbtop 是一个 SequoiaDB 数据库的性能监控工具。通过 sdbtop,可以监控和查看集群中各个节点的监视信息。

选项

参数缩写描述
—help-h返回基本帮助和用法文本
—confpath-csdbtop 的配置文件,sdbtop 界面形态以及输出字段都依赖该文件(缺省使用默认配置文件)
—hostname-i指定需要监控的主机名
—servicename-s指定监控的端口服务名
—usrname-u数据库用户名
—password-p数据库密码,指定值则使用明文输入,不指定值则命令行提示输入
—cipher使用加密文件输入密码,默认为 false
—token加密口令
—cipherfile加密文件,默认为 ./passwd
—ssl使用 SSL 连接

Note:

  • 对于 Ubuntu 等系统,需要安装 Ncurses 库,否则将会提示“Error opening terminal: TERM”

    • 方式一: 联网安装

      1. $ sudo apt-get install libncurses5-dev
    • 方式二: 源码安装

      解压源码包:

      1. $ tar -xvzf ncurses-5.5.tar.gz

      进入 ncurses-5.5 目录

      1. $ ./configure
      2. $ sudo make && make install

使用方法

在下面的例子,sdbtop 使用配置文件为“/opt/sequoiadb/conf/samples/sdbtop.xml”,监控主机名为 hostname1,端口服务名为 11810,用户名为 test,密码为 test 的数据库集群中的一个节点。

  1. $ sdbtop -c /opt/sequoiadb/conf/samples/sdbtop.xml -i hostname1 -s 11810 -u test -p test

接着进入主窗口:

  1. refresh= 3 secs sdbtop 1.0 snapshotMode: GLOBAL
  2. displayMode: ABSOLUTE Main Window snapshotModeInput: NULL
  3. hostname: hostname1 filtering Number: 0
  4. servicename: 11810 sortingWay: NULL sortingField: NULL
  5. usrName: test Refresh: F5, Quit: q, Help: h
  6. ##### ###### ###### ####### ##### ###### For help type h or ...
  7. # # # # # # # # # # sdbtop -h: usage
  8. # # # # # # # # # #
  9. ##### # # ###### # # # ######
  10. # # # # # # # # #
  11. # # # # # # # # #
  12. ##### ###### ###### # ##### #
  13. SDB Interactive Snapshot Monitor V2.0
  14. Use these keys to navigate:
  15. m - Main Window s - Sessions c - CollectionSpaces
  16. t - System d - Database G - GLOBAL_SNAPSHOT
  17. g - GROUP_SNAPSHOT n - NODE_SNAPSHOT r - reset refreshInterval
  18. A - Ascending order D - Descending order C - filter condition
  19. Q - no filter condition N - filter number W - no filter number
  20. Licensed Materials - Property of SequoiaDB
  21. Copyright SequoiaDB Corp. 2013-2014 All Rights Reserved.

Note:

在主窗口中按“**h**”键可以查看所有工具支持的按键

主窗口按键说明

按键描述
m返回主窗口
s列出数据库节点上的所有会话
c列出数据库节点上的所有集合空间
t列出数据库节点上的系统资源使用情况
d列出数据库节点的数据库监视信息
Gglobal_snapshot,监控所有的数据节点组
ggroup_snapshot,指定监控某个数据节点组
nnode_snapshot,列出指定的数据库节点的监视信息
r设置刷屏的时间间隔,单位:秒
A将监视信息按照某列进行顺序排序
D将监视信息按照某列进行逆序排序
C将监视信息按照某个条件进行筛选
Q返回没有使用条件进行筛选前的监视信息
N将监视信息中对应行号的记录过滤不显示
W返回没有使用行号进行过滤前的监视信息
h查看使用帮助
取消已进入的操作
返回上一次监视界面,(在已进入 help 帮助输出中有效)
强制刷新后台监视信息
<向左移动,以查看隐藏的左边列的监视信息
>向右移动,以查看隐藏的右边列的监视信息
q退出程序
切换数据计算的模式(绝对值,平均值,差值三个模式)

例子

  1. 进入主窗口后,按“s”键,列出数据库节点的所有会话信息

    1. refresh= 3 secs sdbtop 1.0 snapshotMode: GLOBAL
    2. displayMode: ABSOLUTE Sessions snapshotModeInput: NULL
    3. hostname: hostname1 filtering Number: 0
    4. servicename: 11810 sortingWay: NULL sortingField: NULL
    5. usrName: test Refresh: F5, Quit: q, Help: h
    6. SessionID TID Type Name
    7. ------------------------------ ---------- ------------------ ------------------------------
    8. 1 hostname1:11820:1 10732 LogWriter ""
    9. 2 hostname1:11820:10 10741 Task Job[Prefetcher]
    10. 3 hostname1:11820:11 10742 Task Job[Prefetcher]
    11. 4 hostname1:11820:12 10743 Task Job[Prefetcher]
    12. 5 hostname1:11820:13 10744 Cluster ""
    13. 6 hostname1:11820:14 10745 ClusterShard ""
    14. 7 hostname1:11820:15 10746 ClusterLogNotify ""
    15. 8 hostname1:11820:16 10747 ShardReader ""
    16. 9 hostname1:11820:17 10748 ReplReader ""
    17. 10 hostname1:11820:18 10749 SyncClockWorker ""
    18. 11 hostname1:11820:19 10750 TCPListener ""
    19. 12 hostname1:11820:2 10733 DpsRollback ""
    20. 13 hostname1:11820:20 10751 RestListener ""
    21. 14 hostname1:11820:21 10752 Task Job[PageCleaner]
    22. 15 hostname1:11820:3 10734 Task Job[Prefetcher]
    23. 16 hostname1:11820:4 10735 Task Job[Prefetcher]
    24. 17 hostname1:11820:42 10847 ReplAgent NodeID:1000,TID:1,Start:active
    25. 18 hostname1:11820:5 10736 Task Job[Prefetcher]
    26. 19 hostname1:11820:59 23263 ShardAgent NetID:1,TID:23262
    27. 20 hostname1:11820:6 10737 Task Job[Prefetcher]
    28. 21 hostname1:11820:7 10738 Task Job[Prefetcher]
    29. 22 hostname1:11820:8 10739 Task Job[Prefetcher]
  2. 按“Tab”键,可以看到屏幕左上方的“displayMode”的值会发生切换

  3. 按“r”键,在屏幕最下方输入“2”,回车,设置刷新间隔时间,可以看到屏幕左上方的“refresh”的值变为 2

    1. refresh= 2 secs sdbtop 1.0 snapshotMode: GLOBAL
    2. displayMode: ABSOLUTE Sessions snapshotModeInput: NULL
    3. hostname: hostname1 filtering Number: 0
    4. servicename: 11810 sortingWay: NULL sortingField: NULL
    5. usrName: test Refresh: F5, Quit: q, Help: h
    6. SessionID TID Type Name
    7. ------------------------------ ---------- ------------------ ------------------------------
    8. 1 hostname1:11820:1 10732 LogWriter ""
    9. 2 hostname1:11820:10 10741 Task Job[Prefetcher]
    10. 3 hostname1:11820:11 10742 Task Job[Prefetcher]
    11. 4 hostname1:11820:12 10743 Task Job[Prefetcher]
    12. 5 hostname1:11820:13 10744 Cluster ""
    13. 6 hostname1:11820:14 10745 ClusterShard ""
    14. 7 hostname1:11820:15 10746 ClusterLogNotify ""
    15. 8 hostname1:11820:16 10747 ShardReader ""
    16. 9 hostname1:11820:17 10748 ReplReader ""
    17. 10 hostname1:11820:18 10749 SyncClockWorker ""
    18. 11 hostname1:11820:19 10750 TCPListener ""
    19. 12 hostname1:11820:2 10733 DpsRollback ""
    20. 13 hostname1:11820:20 10751 RestListener ""
    21. 14 hostname1:11820:21 10752 Task Job[PageCleaner]
    22. 15 hostname1:11820:3 10734 Task Job[Prefetcher]
    23. 16 hostname1:11820:4 10735 Task Job[Prefetcher]
    24. 17 hostname1:11820:42 10847 ReplAgent NodeID:1000,TID:1,Start:active
    25. 18 hostname1:11820:5 10736 Task Job[Prefetcher]
    26. 19 hostname1:11820:59 23263 ShardAgent NetID:1,TID:23262
    27. 20 hostname1:11820:6 10737 Task Job[Prefetcher]
    28. 21 hostname1:11820:7 10738 Task Job[Prefetcher]
    29. 22 hostname1:11820:8 10739 Task Job[Prefetcher]
  4. 按“A”键,并输入“TID”,列表结果按照 TID 进行顺序排序

    1. refresh= 2 secs sdbtop 1.0 snapshotMode: GLOBAL
    2. displayMode: ABSOLUTE Sessions snapshotModeInput: NULL
    3. hostname: hostname1 filtering Number: 0
    4. servicename: 11810 sortingWay: NULL sortingField: NULL
    5. usrName: test Refresh: F5, Quit: q, Help: h
    6. SessionID TID Type Name
    7. ------------------------------ ---------- ------------------ ------------------------------
    8. 1 hostname1:11820:1 10732 LogWriter ""
    9. 2 hostname1:11820:10 10741 Task Job[Prefetcher]
    10. 3 hostname1:11820:11 10742 Task Job[Prefetcher]
    11. 4 hostname1:11820:12 10743 Task Job[Prefetcher]
    12. 5 hostname1:11820:13 10744 Cluster ""
    13. 6 hostname1:11820:14 10745 ClusterShard ""
    14. 7 hostname1:11820:15 10746 ClusterLogNotify ""
    15. 8 hostname1:11820:16 10747 ShardReader ""
    16. 9 hostname1:11820:17 10748 ReplReader ""
    17. 10 hostname1:11820:18 10749 SyncClockWorker ""
    18. 11 hostname1:11820:19 10750 TCPListener ""
    19. 12 hostname1:11820:2 10733 DpsRollback ""
    20. 13 hostname1:11820:20 10751 RestListener ""
    21. 14 hostname1:11820:21 10752 Task Job[PageCleaner]
    22. 15 hostname1:11820:3 10734 Task Job[Prefetcher]
    23. 16 hostname1:11820:4 10735 Task Job[Prefetcher]
    24. 17 hostname1:11820:42 10847 ReplAgent NodeID:1000,TID:1,Start:active
    25. 18 hostname1:11820:5 10736 Task Job[Prefetcher]
    26. 19 hostname1:11820:59 23263 ShardAgent NetID:1,TID:23262
    27. 20 hostname1:11820:6 10737 Task Job[Prefetcher]
    28. 21 hostname1:11820:7 10738 Task Job[Prefetcher]
    29. please input the displayName which need order by asc : TID
  5. 按“N”键,并输入“1”,列表中将原来行号为 1 的记录过滤不显示

  6. 按“W”键,返回没有按行号进行过滤前的列表信息

  7. 按“C”键,并输入“TID:10732”进行筛选,则只显示 TID 值为 10732 的记录

    1. refresh= 2 secs sdbtop 1.0 snapshotMode: GLOBAL
    2. displayMode: ABSOLUTE Sessions snapshotModeInput: NULL
    3. hostname: hostname1 filtering Number: 0
    4. servicename: 11810 sortingWay: NULL sortingField: NULL
    5. usrName: test Refresh: F5, Quit: q, Help: h
    6. SessionID TID Type Name
    7. ------------------------------ ---------- ------------------ ------------------------------
    8. 1 hostname1:11820:1 10732 LogWriter ""
    9. 2 hostname1:11820:10 10741 Task Job[Prefetcher]
    10. 3 hostname1:11820:11 10742 Task Job[Prefetcher]
    11. 4 hostname1:11820:12 10743 Task Job[Prefetcher]
    12. 5 hostname1:11820:13 10744 Cluster ""
    13. 6 hostname1:11820:14 10745 ClusterShard ""
    14. 7 hostname1:11820:15 10746 ClusterLogNotify ""
    15. 8 hostname1:11820:16 10747 ShardReader ""
    16. 9 hostname1:11820:17 10748 ReplReader ""
    17. 10 hostname1:11820:18 10749 SyncClockWorker ""
    18. 11 hostname1:11820:19 10750 TCPListener ""
    19. 12 hostname1:11820:2 10733 DpsRollback ""
    20. 13 hostname1:11820:20 10751 RestListener ""
    21. 14 hostname1:11820:21 10752 Task Job[PageCleaner]
    22. 15 hostname1:11820:3 10734 Task Job[Prefetcher]
    23. 16 hostname1:11820:4 10735 Task Job[Prefetcher]
    24. 17 hostname1:11820:42 10847 ReplAgent NodeID:1000,TID:1,Start:active
    25. 18 hostname1:11820:5 10736 Task Job[Prefetcher]
    26. 19 hostname1:11820:59 23263 ShardAgent NetID:1,TID:23262
    27. 20 hostname1:11820:6 10737 Task Job[Prefetcher]
    28. 21 hostname1:11820:7 10738 Task Job[Prefetcher]
    29. please input the filter condition : TID:10732
  8. 按“Q”键,返回没有按照筛选条件前的列表信息

  9. 按“<”或者“>”键,可以查看隐藏在左边或者右边的列