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:
Clone the opentsdb.git project and check out the v2.0.0 branch:
opentsdb/tsdb.infile and add the following MapR dependencies:
BASEMAPRDIR: the root directory of the MapR installation
core-site.xmlin the classpath for Hadoop-0.2x/Hadoop-2.x:
MapR-specific jars in the classpath:
See tsdb.in Updates.
Install dependencies for graph generation:
asynchbase.jarfile with the MapR version of that file:
Run the build script:
Edit the following file and add "/" before the table names so that MapR recognizes them as MapR-DB tables:
Create tables in MapR-DB:
Run the following command to verify that the tables are created successfully:
Create a simple metric to store, such as “sys.cpu.user”:
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.
Log into the web UI:
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.
Check the plot in the UI.
select From date and check autoreload.
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.
Note the changes to the
Base of MapR installation section.
Note the changed sections for the
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:
- Install MapR Version 4.1 and HBase 0.98.7 or 0.98.9.
- Install the latest
Install the OpenTSDB RPM:
rpm -ivh opentsdb-2.0.0.noarch.rpm
- Configure OpenTSDB to work with MapR:
Edit the following
tsdbscripts to cover MapR-specific dependencies:
Replace the asynchbase jar file (provide the current jar file name in the
These files must have the following settings:
<OPENTSDB_ROOT_INSTALL_DIR>/src/create_table.shfile and add "/" before the table names so that MapR recognizes them as MapR-DB tables.
Then create tables in MapR-DB:
Confirm that the tables are created:
tsddaemon. 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).
- Create a metric:
/usr/share/opentsdb/bin/tsdb mkmetric mymetric.stock
- Test the metric:
- 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).
- 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
- Check the results.
Expected Results of SUM query