Document Type:
How to
Environment:
YugabyteDB Cluster, Platform/YBAnywhere Host.
Versions:
Any
Overview:
yb_stats is a utility to extract detailed runtime data from a YugabyteDB cluster for performance and troubleshooting purposes. It functions in two modes:
-
ad-hoc mode: begin and end capturing of performance (metric) data for performance analysis, which does not store any data (called without the
--snapshot
switch). -
snapshot mode: full capturing of all YugabyteDB cluster metadata and metrics for performance and troubleshooting analysis. The data is stored in CSV files in a directory in the current working directory.
This is a how to page for yb_stats
usage for Support Tickets. For additional details on the tool and more usage instructions please refer to yb_stats on github.
Download and Installation Instructions:
Install the provided yb_stats RPM via yum:
EL7:
sudo yum install https://github.com/fritshoogland-yugabyte/yb_stats/releases/download/v0.9.8/yb_stats-0.9.8-el.7.x86_64.rpm
EL8:
sudo yum install https://github.com/fritshoogland-yugabyte/yb_stats/releases/download/v0.9.8/yb_stats-0.9.8-el.8.x86_64.rpm
EL9:
sudo yum install https://github.com/fritshoogland-yugabyte/yb_stats/releases/download/v0.9.8/yb_stats-0.9.8-el.9.x86_64.rpm
For Debian (Ubuntu etc), Install the provided yb_stats .deb package using dpkeg utility.
sudo wget https://github.com/fritshoogland-yugabyte/yb_stats/releases/download/v0.9.8/yb-stats_0.9.8_amd64.deb
sudo dpkg -i yb-stats_0.9.8_amd64.deb
After yum install, yb_stats is available in /usr/local/bin, which should normally be in $PATH.
These are current latest versions. Look yb_stats github repository releases page for newer versions.
Data Collection:
For data collection, yb_stats requires you to provide the hostnames or ip addresses, and the port numbers if these are non-default. Hostnames and ports are provided using separate switches: --hosts
and --ports
. Once hostnames or ports have been specified, these will be stored in the current working directory in a file called .env
, which allows yb_stats to use the hostnames and ports without requiring to specify them again.
Test run:
The `yb_stats` utility can be run on any Database hosts or the YBA hosts.
Run a sample command and check the output of .env:
yb_stats --help
yb_stats --hosts 10.215.0.5,10.215.0.6,10.215.0.7 --snapshot
cat .env
YBSTATS_HOSTS=10.215.0.5,10.215.0.6,10.215.0.7
To Schedule the job:
To schedule the job via crontab, use a similar crontab entry. An example to run at 5 minute past every hour is below:
5 */1 * * * yb_stats_path="/home/yugabyte" && (date && cd $yb_stats_path && $PATH/yb_stats --snapshot --parallel 3) >> ${yb_stats_path}/yb_stats_run.out 2>&1
Options Used:
--parallel
<parallel> how much threads to use in parallel for fetching data [default: 1]
--snapshot
perform a CSV (stored) snapshot
(No need to provide --hosts
option as the command was already executed and it stores the Host(s) details in .env file.)
yb_stats_path
Directory to store the Snapshot files, ensure the directory has permissions and enough space depending on how long the job is scheduled to run.
Check the output/snapshot generated:
Check the output generated to ensure the data is gathered as expected:
yb_stats --print-threads 1
Options Used:
--print-threads
requires a single snapshot number as argument, and prints the thread information that is captured.
Or
--print-memtrackers
requires a single snapshot number as argument, and prints the mem-trackers information that is captured.
Reference:
GitHub - fritshoogland-yugabyte/yb_stats
Comments
0 comments
Please sign in to leave a comment.