Solution 1: to avoid this to happen from start, set the tsd.storage.fix_duplicates
flag to true
in your opentsdb.conf
.
Solution 2: In case you already have duplicate values written to your Hbase (the underlying datastore), and are unable to query the openTSDB - use the fsck
utility: while inside opentsdb/build/
Specific query:
./tsdb fsck --fix-all 1h-ago now sum <metric-name> tag1=val1
For metric:
./tsdb fsck --threads=2 --fix-all --resolve-duplicates 15d-ago sum <metric name>
Full Table: all the data in the Hbase's 'tsdb' table (the one table openTSDB stores data)
./tsdb fsck --full-scan --threads=8 --fix-all --resolve-duplicates --compact
The helpful fsck
flags:
--fix-all
- Sets all repair flags to attempt to fix all issues at once. Use with caution.--compact
Compacts non-compacted rows during a repair.--delete-bad-compacts
Removes columns that appear to be compacted but failed parsing. If a column parses properly but the final byte of the value is not set to a 0 or a 1, the column will be left alone.--resolve-duplicates
Enables duplicate data point resolution by deleting all but the latest or oldest data point. Also see --last-write-wins.--last-write-wins
Flag When set, deletes all but the most recently written data point when resolving duplicates. If the config valuetsd.storage.fix_duplicates
is set totrue
, then the latest data point will be kept regardless of this value. Not Set --last-write-wins--full-scan
Scans the entire data table. Note: This can take a very long time to complete.--threads
Integer The number of threads to use when performing a full scan. The default is twice the number of CPU cores.