uid

    Use the UID utility with the command line:

    Parameters specific to the UID utility include:

    Lookup

    The lookup command is the default for uid used to lookup the UID assigned to a name or the name assinged to a UID for a given type.

    1. <kind> <name>
    2. <kind> <UID>

    Example Command

    1. ./tsdb uid tagk host

    Example Response

    1. tagk host: [0, 0, 1]

    grep

    The grep sub command performs a regular expression search for the given UID type and returns a list of all UID names that match the expression. Fields required for the grep command include:

    Command Format

    1. grep <kind> '<expression>'

    Example Command

    1. ./tsdb uid grep metrics 'disk.*write'

    Example Response

    1. metrics iostat.disk.msec_write: [0, 3, -67]
    2. metrics iostat.disk.write_merged: [0, 3, -69]
    3. metrics iostat.disk.write_requests: [0, 3, -70]
    4. metrics iostat.disk.write_sectors: [0, 3, -68]

    This sub command is used to assign IDs to new unique names for metrics, tag names or tag values. Supply a list of one or more values to assign UIDs and the list of assignments will be returned.

    Name

    Data Type

    Description

    Example

    kind

    String

    The type of the UID the names represent. Must be one of metrics, tagk or tagv

    tagk

    name

    String

    One or more names to assign UIDs to. Names must not be in quotes and cannot contain spaces.

    owner

    Command Format

    Example Command

    rename

    Changes the name of an already assigned UID. If the UID of the given type does not exist, an error will be returned.

    Note

    After changing a UID name you must flush the cache (see /api/dropcaches) or restart all TSDs for the change to take effect. TSDs do not periodically reload UID maps.

    Command Format

    1. rename <kind> <name> <newname>

    Example Command

    1. ./tsdb uid rename metrics disk.d0 disk.d0.bytes_read

    delete

    Removes the mapping of the UID from the tsdb-uid table. Make sure all sources are no longer writing data using the UID and that sufficient time has passed so that users would not query for data that used the UIDs.

    Note

    After deleting a UID, it may still remain in the caches of running TSD servers. Make sure to flush their caches after deleting an entry.

    Warning

    Deleting a UID will not delete the underlying data associated with the UIDs (we’re working on that). For metrics this is safe, it won’t affect queries. But for tag names and values, if a query scans over data containing the old UID, the query will fail with an exception because it can no longer find the name mapping.

    Name

    Data Type

    Description

    Example

    kind

    String

    The type of the UID the name represent. Must be one of metrics, tagk or tagv

    tagk

    name

    String

    The existing UID name

    owner

    Command Format

    1. delete <kind> <name>

    Example Command

      The UID FSCK command will scan the entire UID table for errors pertaining to name and UID mappings. By default, the run will scan every column in the table and log any errors that were found. With version 2.1 it is possible to fix errors in the table by passing the “fix” flag. UIDMeta objects are skipped during scanning. Possible errors include:

      Options

      • fix - Attempts to fix errors per the table above

      • delete_unknown - Removes any columns in the UID table that do not belong to OpenTSDB

      Command Format

      1. fsck [fix] [delete_unknown]

      Example Command

      1. ./tsdb uid fsck fix

      Example Response

      1. INFO [main] UidManager: ----------------------------------
      2. INFO [main] UidManager: - Running fsck in FIX mode -
      3. INFO [main] UidManager: - Remove Unknowns: false -
      4. INFO [main] UidManager: ----------------------------------
      5. INFO [main] UidManager: Maximum ID for tagk: 4
      6. INFO [main] UidManager: Maximum ID for tagv: 2
      7. ERROR [main] UidManager: Forward tagk mapping is missing reverse mapping: bar -> 000004
      8. INFO [main] UidManager: FIX: Restoring tagk reverse mapping: 000004 -> bar
      9. ERROR [main] UidManager: Inconsistent reverse tagk mapping 000003 -> bar vs 000004 -> bar / bar -> 000004
      10. INFO [main] UidManager: FIX: Removed tagk reverse mapping: 000003 -> bar
      11. ERROR [main] UidManager: tagk: Found 2 errors.
      12. INFO [main] UidManager: 17 KVs analyzed in 334ms (~50 KV/s)
      13. WARN [main] UidManager: 2 errors found.

      metasync

      This command will run through the entire data table, scanning each row of timeseries data and generate missing TSMeta objects and UIDMeta objects or update the created timestamps for each object type if necessary. Use this command after enabling meta tracking with existing data or if you suspect that some timeseries may not have been indexed properly. The command will also push new or updated meta entries to a search engine if a plugin has been configured. If existing meta is corrupted, meaning the TSD is unable to deserialize the object, it will be replaced with a new entry.

      It is safe to run this command at any time as it will not destroy or overwrite valid data. (Unless you modify columns directly in HBase in a manner inconsistent with the meta data formats). The utility will split the data table into chunks processed by multiple threads so the more cores in your processor, the faster the command will complete.

      Example Command

      1. ./tsdb uid metasync

      metapurge

      This sub command will mark all TSMeta and UIDMeta objects for deletion in the UID table. This is useful for downgrading from 2.0 to a 1.x version or simply flushing all meta data and starting over with a metasync.

      Command Format

      1. metapurge

      Example Command

      1. ./tsdb uid metapurge

      Runs through the list of TSMeta objects in the UID table and processes each through all configured and enabled trees to compile branches. This command may be run at any time and will not affect existing objects.

      Command Format

      1. treesync

      Example Command

      1. ./tsdb uid treesync

      treepurge

      Removes all branches, collision, not matched data and optionally the tree definition itself for a given tree. Parameters include:

      Name

      Data Type

      Description

      Example

      id

      Integer

      ID of the tree to purge

      1

      definition

      Flag

      Add this literal after the ID to delete the definition of the tree as well as the data

      Command Format

      1. treepurge <id> [definition]

      Example Command