数据库性能工具
sdbtop 是一个 SequoiaDB 数据库的性能监控工具。通过 sdbtop,可以监控和查看集群中各个节点的监视信息。
选项
参数 | 缩写 | 描述 |
---|---|---|
—help | -h | 返回基本帮助和用法文本 |
—confpath | -c | sdbtop 的配置文件,sdbtop 界面形态以及输出字段都依赖该文件(缺省使用默认配置文件) |
—hostname | -i | 指定需要监控的主机名 |
—servicename | -s | 指定监控的端口服务名 |
—usrname | -u | 数据库用户名 |
—password | -p | 数据库密码,指定值则使用明文输入,不指定值则命令行提示输入 |
—cipher | 使用加密文件输入密码,默认为 false | |
—token | 加密口令 | |
—cipherfile | 加密文件,默认为 ./passwd | |
—ssl | 使用 SSL 连接 |
Note:
对于 Ubuntu 等系统,需要安装 Ncurses 库,否则将会提示“Error opening terminal: TERM”
方式一: 联网安装
$ sudo apt-get install libncurses5-dev
方式二: 源码安装
解压源码包:
$ tar -xvzf ncurses-5.5.tar.gz
进入 ncurses-5.5 目录
$ ./configure
$ sudo make && make install
使用方法
在下面的例子,sdbtop 使用配置文件为“/opt/sequoiadb/conf/samples/sdbtop.xml”,监控主机名为 hostname1,端口服务名为 11810,用户名为 test,密码为 test 的数据库集群中的一个节点。
$ sdbtop -c /opt/sequoiadb/conf/samples/sdbtop.xml -i hostname1 -s 11810 -u test -p test
接着进入主窗口:
refresh= 3 secs sdbtop 1.0 snapshotMode: GLOBAL
displayMode: ABSOLUTE Main Window snapshotModeInput: NULL
hostname: hostname1 filtering Number: 0
servicename: 11810 sortingWay: NULL sortingField: NULL
usrName: test Refresh: F5, Quit: q, Help: h
##### ###### ###### ####### ##### ###### For help type h or ...
# # # # # # # # # # sdbtop -h: usage
# # # # # # # # # #
##### # # ###### # # # ######
# # # # # # # # #
# # # # # # # # #
##### ###### ###### # ##### #
SDB Interactive Snapshot Monitor V2.0
Use these keys to navigate:
m - Main Window s - Sessions c - CollectionSpaces
t - System d - Database G - GLOBAL_SNAPSHOT
g - GROUP_SNAPSHOT n - NODE_SNAPSHOT r - reset refreshInterval
A - Ascending order D - Descending order C - filter condition
Q - no filter condition N - filter number W - no filter number
Licensed Materials - Property of SequoiaDB
Copyright SequoiaDB Corp. 2013-2014 All Rights Reserved.
Note:
在主窗口中按“**h**”键可以查看所有工具支持的按键
主窗口按键说明
按键 | 描述 |
---|---|
m | 返回主窗口 |
s | 列出数据库节点上的所有会话 |
c | 列出数据库节点上的所有集合空间 |
t | 列出数据库节点上的系统资源使用情况 |
d | 列出数据库节点的数据库监视信息 |
G | global_snapshot,监控所有的数据节点组 |
g | group_snapshot,指定监控某个数据节点组 |
n | node_snapshot,列出指定的数据库节点的监视信息 |
r | 设置刷屏的时间间隔,单位:秒 |
A | 将监视信息按照某列进行顺序排序 |
D | 将监视信息按照某列进行逆序排序 |
C | 将监视信息按照某个条件进行筛选 |
Q | 返回没有使用条件进行筛选前的监视信息 |
N | 将监视信息中对应行号的记录过滤不显示 |
W | 返回没有使用行号进行过滤前的监视信息 |
h | 查看使用帮助 |
取消已进入的操作 | |
返回上一次监视界面,(在已进入 help 帮助输出中有效) | |
强制刷新后台监视信息 | |
< | 向左移动,以查看隐藏的左边列的监视信息 |
> | 向右移动,以查看隐藏的右边列的监视信息 |
q | 退出程序 |
切换数据计算的模式(绝对值,平均值,差值三个模式) |
例子
进入主窗口后,按“s”键,列出数据库节点的所有会话信息
refresh= 3 secs sdbtop 1.0 snapshotMode: GLOBAL
displayMode: ABSOLUTE Sessions snapshotModeInput: NULL
hostname: hostname1 filtering Number: 0
servicename: 11810 sortingWay: NULL sortingField: NULL
usrName: test Refresh: F5, Quit: q, Help: h
SessionID TID Type Name
------------------------------ ---------- ------------------ ------------------------------
1 hostname1:11820:1 10732 LogWriter ""
2 hostname1:11820:10 10741 Task Job[Prefetcher]
3 hostname1:11820:11 10742 Task Job[Prefetcher]
4 hostname1:11820:12 10743 Task Job[Prefetcher]
5 hostname1:11820:13 10744 Cluster ""
6 hostname1:11820:14 10745 ClusterShard ""
7 hostname1:11820:15 10746 ClusterLogNotify ""
8 hostname1:11820:16 10747 ShardReader ""
9 hostname1:11820:17 10748 ReplReader ""
10 hostname1:11820:18 10749 SyncClockWorker ""
11 hostname1:11820:19 10750 TCPListener ""
12 hostname1:11820:2 10733 DpsRollback ""
13 hostname1:11820:20 10751 RestListener ""
14 hostname1:11820:21 10752 Task Job[PageCleaner]
15 hostname1:11820:3 10734 Task Job[Prefetcher]
16 hostname1:11820:4 10735 Task Job[Prefetcher]
17 hostname1:11820:42 10847 ReplAgent NodeID:1000,TID:1,Start:active
18 hostname1:11820:5 10736 Task Job[Prefetcher]
19 hostname1:11820:59 23263 ShardAgent NetID:1,TID:23262
20 hostname1:11820:6 10737 Task Job[Prefetcher]
21 hostname1:11820:7 10738 Task Job[Prefetcher]
22 hostname1:11820:8 10739 Task Job[Prefetcher]
按“Tab”键,可以看到屏幕左上方的“displayMode”的值会发生切换
按“r”键,在屏幕最下方输入“2”,回车,设置刷新间隔时间,可以看到屏幕左上方的“refresh”的值变为 2
refresh= 2 secs sdbtop 1.0 snapshotMode: GLOBAL
displayMode: ABSOLUTE Sessions snapshotModeInput: NULL
hostname: hostname1 filtering Number: 0
servicename: 11810 sortingWay: NULL sortingField: NULL
usrName: test Refresh: F5, Quit: q, Help: h
SessionID TID Type Name
------------------------------ ---------- ------------------ ------------------------------
1 hostname1:11820:1 10732 LogWriter ""
2 hostname1:11820:10 10741 Task Job[Prefetcher]
3 hostname1:11820:11 10742 Task Job[Prefetcher]
4 hostname1:11820:12 10743 Task Job[Prefetcher]
5 hostname1:11820:13 10744 Cluster ""
6 hostname1:11820:14 10745 ClusterShard ""
7 hostname1:11820:15 10746 ClusterLogNotify ""
8 hostname1:11820:16 10747 ShardReader ""
9 hostname1:11820:17 10748 ReplReader ""
10 hostname1:11820:18 10749 SyncClockWorker ""
11 hostname1:11820:19 10750 TCPListener ""
12 hostname1:11820:2 10733 DpsRollback ""
13 hostname1:11820:20 10751 RestListener ""
14 hostname1:11820:21 10752 Task Job[PageCleaner]
15 hostname1:11820:3 10734 Task Job[Prefetcher]
16 hostname1:11820:4 10735 Task Job[Prefetcher]
17 hostname1:11820:42 10847 ReplAgent NodeID:1000,TID:1,Start:active
18 hostname1:11820:5 10736 Task Job[Prefetcher]
19 hostname1:11820:59 23263 ShardAgent NetID:1,TID:23262
20 hostname1:11820:6 10737 Task Job[Prefetcher]
21 hostname1:11820:7 10738 Task Job[Prefetcher]
22 hostname1:11820:8 10739 Task Job[Prefetcher]
按“A”键,并输入“TID”,列表结果按照 TID 进行顺序排序
refresh= 2 secs sdbtop 1.0 snapshotMode: GLOBAL
displayMode: ABSOLUTE Sessions snapshotModeInput: NULL
hostname: hostname1 filtering Number: 0
servicename: 11810 sortingWay: NULL sortingField: NULL
usrName: test Refresh: F5, Quit: q, Help: h
SessionID TID Type Name
------------------------------ ---------- ------------------ ------------------------------
1 hostname1:11820:1 10732 LogWriter ""
2 hostname1:11820:10 10741 Task Job[Prefetcher]
3 hostname1:11820:11 10742 Task Job[Prefetcher]
4 hostname1:11820:12 10743 Task Job[Prefetcher]
5 hostname1:11820:13 10744 Cluster ""
6 hostname1:11820:14 10745 ClusterShard ""
7 hostname1:11820:15 10746 ClusterLogNotify ""
8 hostname1:11820:16 10747 ShardReader ""
9 hostname1:11820:17 10748 ReplReader ""
10 hostname1:11820:18 10749 SyncClockWorker ""
11 hostname1:11820:19 10750 TCPListener ""
12 hostname1:11820:2 10733 DpsRollback ""
13 hostname1:11820:20 10751 RestListener ""
14 hostname1:11820:21 10752 Task Job[PageCleaner]
15 hostname1:11820:3 10734 Task Job[Prefetcher]
16 hostname1:11820:4 10735 Task Job[Prefetcher]
17 hostname1:11820:42 10847 ReplAgent NodeID:1000,TID:1,Start:active
18 hostname1:11820:5 10736 Task Job[Prefetcher]
19 hostname1:11820:59 23263 ShardAgent NetID:1,TID:23262
20 hostname1:11820:6 10737 Task Job[Prefetcher]
21 hostname1:11820:7 10738 Task Job[Prefetcher]
please input the displayName which need order by asc : TID
按“N”键,并输入“1”,列表中将原来行号为 1 的记录过滤不显示
按“W”键,返回没有按行号进行过滤前的列表信息
按“C”键,并输入“TID:10732”进行筛选,则只显示 TID 值为 10732 的记录
refresh= 2 secs sdbtop 1.0 snapshotMode: GLOBAL
displayMode: ABSOLUTE Sessions snapshotModeInput: NULL
hostname: hostname1 filtering Number: 0
servicename: 11810 sortingWay: NULL sortingField: NULL
usrName: test Refresh: F5, Quit: q, Help: h
SessionID TID Type Name
------------------------------ ---------- ------------------ ------------------------------
1 hostname1:11820:1 10732 LogWriter ""
2 hostname1:11820:10 10741 Task Job[Prefetcher]
3 hostname1:11820:11 10742 Task Job[Prefetcher]
4 hostname1:11820:12 10743 Task Job[Prefetcher]
5 hostname1:11820:13 10744 Cluster ""
6 hostname1:11820:14 10745 ClusterShard ""
7 hostname1:11820:15 10746 ClusterLogNotify ""
8 hostname1:11820:16 10747 ShardReader ""
9 hostname1:11820:17 10748 ReplReader ""
10 hostname1:11820:18 10749 SyncClockWorker ""
11 hostname1:11820:19 10750 TCPListener ""
12 hostname1:11820:2 10733 DpsRollback ""
13 hostname1:11820:20 10751 RestListener ""
14 hostname1:11820:21 10752 Task Job[PageCleaner]
15 hostname1:11820:3 10734 Task Job[Prefetcher]
16 hostname1:11820:4 10735 Task Job[Prefetcher]
17 hostname1:11820:42 10847 ReplAgent NodeID:1000,TID:1,Start:active
18 hostname1:11820:5 10736 Task Job[Prefetcher]
19 hostname1:11820:59 23263 ShardAgent NetID:1,TID:23262
20 hostname1:11820:6 10737 Task Job[Prefetcher]
21 hostname1:11820:7 10738 Task Job[Prefetcher]
please input the filter condition : TID:10732
按“Q”键,返回没有按照筛选条件前的列表信息
按“<”或者“>”键,可以查看隐藏在左边或者右边的列