This is documentation for MapR Version 5.0. You can also refer to MapR documentation for the latest release.

Skip to end of metadata
Go to start of metadata

The OpenTSDB software package provides a time-series database that collects user-specified data. Because OpenTSDB depends on AsyncHBase, MapR provides a customized version of OpenTSDB that works with AsyncHBase for MapR-DB.

This document explains how to build OpenTSDB from source, using the Github repository, or install the RPM or Debian distribution for OpenTSDB.

See also Documentation for OpenTSDB.


OpenTSDB for MapR-DB Version 4.1 requires:

  • Version 4.1.x of the MapR Distribution for Hadoop
  • The latest release of the mapr-hbase package (0.98.7 or 0.98.9): 
  • The latest release of the mapr-asynchbase package (1.6)

For information about OpenTSDB for Mapr-DB Version 4.0.x, see Using OpenTSDB with AsyncHBase and MapR-DB.

To Build OpenTSDB from Source:

  1. Clone the opentsdb.git project and check out the v2.0.0 branch:

  2. Open the opentsdb/ file and add the following MapR dependencies:

    1. BASEMAPRDIR: the root directory of the MapR installation
    2. Hadoop core-site.xml in the classpath for Hadoop-0.2x/Hadoop-2.x:
      BASEMAPRDIR/hadoop/hadoop-0.20.2/conf or BASEMAPRDIR/hadoop/hadoop-2.x/conf

    3. MapR-specific jars in the classpath: BASEMAPRDIR/hadoop/hadoop-0.20.2/lib/*

      See Updates.

  3. Install dependencies for graph generation:

  4. Replace the asynchbase.jar file with the MapR version of that file:

  5. Run the build script:

  6. Edit the following file and add "/" before the table names so that MapR recognizes them as MapR-DB tables:

    See Updates.

  7. Create tables in MapR-DB:

  8. Run the following command to verify that the tables are created successfully:

  9. Create a simple metric to store, such as “sys.cpu.user”:

  10. Run the OpenTSDB daemon (tsd):

    Note: Instead of providing these options on command line, you can configure the values in the opentsdb.conf file. This file must be in the root folder so the option settings are read when tsd is run. Also note that the staticroot argument points to the static UI files. You do not need to create cachedir because openstdb creates it automatically. Specifying the destination cachedir argument is enough. You do need to explicitly specify tsdb tables (tsdb, tsdb-uid) and Zookeeper quorum nodes.

  11. Log into the web UI: http://<TSD_Installed_Node_IP>:<Port>

    For example:

  12. Run a simple test program that generates data and sends repeated puts for the metric over a socket connection: <UI-IP>:<UI-Port>
    See Data Generator Program.

  13. Check the plot in the UI.

    1. select From date and check autoreload.

    2. Fill in the metric (in this case, sys.cpu.user) and the Tag keys (cpu, host) values (webserver 0, webserver 1). You should see a graph with a random plot. Updates

Note the changes to the Base of MapR installation section. Updates

Note the changed sections for the *_TABLE variables.


Data Generator Program

Note: This program tries to put metrics for 2 hosts (webserver 0 and webserver 1). Each host has 2 CPUs (cpu 0 and cpu 1). Sample puts look like this:

Note: When you run the program, you should see entries that indicate that the tags for the metric were created, and they should auto-complete on the UI.

You can also verify this from command line instead of the UI:

Installing the RPM or Debian Distribution

Follow these steps to install the RPM or Debian distribution for OpenTSDB:

  1. Install MapR Version 4.1 and HBase 0.98.7 or 0.98.9.
  2. Install the latest mapr-asynchbase-1.6.0.* package.
  3. Install the OpenTSDB RPM:

    1. mkdir /root/opentsdbrpm
    2. cd /root/opentsdbrpm
    3. wget -O opentsdb-2.0.0.noarch.rpm
    4. rpm -ivh opentsdb-2.0.0.noarch.rpm
  4. Configure OpenTSDB to work with MapR:
    1. Edit the following tsdb scripts to cover MapR-specific dependencies: /usr/share/opentsdb/bin/tsdb and /usr/bin/tsdb

    2. Replace the asynchbase jar file (provide the current jar file name in the cp command):

    3. Configure the opentsdb.conf files:

      These files must have the following settings:

    4. Edit the <OPENTSDB_ROOT_INSTALL_DIR>/src/ file and add "/" before the table names so that MapR recognizes them as MapR-DB tables. 

      Then create tables in MapR-DB:

      See Updates.


    5. Confirm that the tables are created:

  5. Start the tsd daemon. You can give executable permissions to the tsdb script in /usr/share/opentsdb/bin, or you can directly use tsdb (because of the dependencies you added earlier).

  6. Create a metric: /usr/share/opentsdb/bin/tsdb mkmetric mymetric.stock
  7. Test the metric:
    1. Run a test program that reads from a tmp_input file and sends put requests to opentsdb, which saves the data to a MapR-DB table (tsdb/tsdb-uid).
    2. Run aggregation queries (such as SUM) from the command line:
      /usr/share/opentsdb/bin/tsdb query 1y-ago sum mymetric.stock
      tsdb query 1y-ago sum mymetric.stock
    3. Check the results.

Test Program

tmp_input File

Expected Results of SUM query


  • No labels