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:
Use the following instructions for the appropriate platform type.
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:
(This needs to be performed on the Platform/YBAnywhere host)
Run a sample command and check the output of .env:
1. ./yb_stats --help
2. ./yb_stats --hosts 10.215.0.5,10.215.0.6,10.215.0.7 --snapshot
3. 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
To run at 5 minute past every hour:
5 */1 * * * yb_stats_path="/home/yugabyte" && (date && cd $yb_stats_path && ./yb_stats --snapshot --parallel 10) >> ${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.