forked from HariSekhon/DevOps-Python-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhbase_table_regionserver_distribution.sh
More file actions
executable file
·47 lines (41 loc) · 1.06 KB
/
hbase_table_regionserver_distribution.sh
File metadata and controls
executable file
·47 lines (41 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2018-07-11 19:36:23 +0100 (Wed, 11 Jul 2018)
#
# https://github.com/harisekhon/devops-python-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# Useful to see table region skew across regionservers
#
# Consider setting for dedicated HBase clusters such as OpenTSDB:
#
# hbase.master.loadbalance.bytable=true
#
#
# Tested on Hortonworks HDP 2.6 (HBase 1.1.2) and Apache HBase 1.3.1
set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x
usage(){
echo "usage: $0 <list of regionservers>"
exit 1
}
port="${REGIONSERVER_PORT:-16030}"
if [ $# -lt 1 ]; then
usage
fi
for server in "$@"; do
echo "$server:"
curl -s "$server:$port/jmx" |
grep 'Namespace_.*_metric_getCount"[[:space:]]*:[[:space:]]*' |
sed 's/.*_table_//; s/_region_.*//' |
sort |
uniq -c
echo
done