Installation
OpenTSDB may be compiled from source or installed from a package. Releases can be found on Github
Runtime Requirements
To actually run OpenTSDB, you'll need to meet the following:
- A Linux System
- Java Runtime Environment 1.6 or later
- HBase 0.92 or later
- GnuPlot 4.2 or later
Installation
First, you need to set up Hbase. If you are brand new to Hbase and/or OpenTSDB we recommend you test with a stand-alone instance as this is the easiest to get up and running. The best palce to start is to follow the Apache Quick Start guide. Alternatively you could try a packaged distribution such as Cloudera's CDH or Hortonworks HDP
Before proceeding with OpenTSDB, make certain that Zookeeper is accessible. One method is to simply telnet to the proper port and execute the stats
command.
[email protected]:~$ telnet localhost 2181
Trying ::1...
Connected to localhost.
Escape character is '^]'.
stats
Zookeeper version: 3.4.6-1569965, built on 02/20/2014 09:09 GMT
Clients:
/10.1.13.10:39211[1](queued=0,recved=21754,sent=21754)
/10.1.13.10:23324[1](queued=0,recved=35211,sent=35211)
/10.1.13.12:62859[1](queued=0,recved=73582,sent=73664)
/10.1.13.10:14687[1](queued=0,recved=37479,sent=37479)
/10.1.13.14:13269[1](queued=0,recved=72166,sent=72166)
/10.1.13.10:39268[1](queued=0,recved=2169,sent=2169)
/10.1.13.11:60416[1](queued=0,recved=21838,sent=21845)
/0:0:0:0:0:0:0:1:62577[0](queued=0,recved=1,sent=0)
/10.1.13.10:38111[1](queued=0,recved=2433,sent=2433)
Latency min/avg/max: 0/0/20034
Received: 321775
Sent: 321875
Connections: 9
Outstanding: 0
Zxid: 0xf00047af3
Mode: follower
Node count: 1737
Connection closed by foreign host.
If you can't connect to Zookeeper, check IPs and name resolution. HBase can be finicky. If HBase is running, you can choose to intall OpenTSDB from a package (avaliable under Releases in Github) or from source using GIT or a source tarball.
Compiling From Source
Compilation requirements include:
- A Linux System
- Java Development Kit 1.6 or later
- GnuPlot 4.2 or later
- Autotools
- Make
- Python
- Git
- An Internet connection
Download the latest version using git clone
command or download a release from the site or Github. Then just run then build.sh
script. This script helps run all the processes needed to compile OpenTSDB: it runs ./bootstrap
(only once, when you first check out the code) , followed by ./configure
and make
. The output of the build process id put into a build
folder and JARS required by OpenTSDB will be downloaded.
git clone git://github.com/OpenTSDB/opentsdb.git
cd opentsdb
./build.sh
If compilation was successfully, you should have a tsdb jar file in ./build
along with a tsdb script. You can now execute command-line tool by invoking ./build/tsdb
or you can run make install
to install OpenTSDB on your system. Should you ever change your mind, there is alse make uninstall
, so there are no strings attached.
If you need to distribute OpenTSDB to machines without an Internet connection, call ./build.sh dist
to wrap the build directory into a tar ball then you can copy to additional mchines.
Source Layout
There are two main branches in the Git repo. The master
branch is the latest stable release along with any bug fixes that have been committed between releases. Currently, the master
branch is OpenTSDB 2.0.1. The next
branch is the next major or minor version of OpenTSDB with new deatures and developmetn. When next
branch is stable, it will be merged into master
. Currently the next branch is 2.1.0 RC 1. Additional branches may be present and are used for testing or development specific features.
Debian Package
You can genereate a Debian package by calling sh build.sh debian
. The package will be located at ./build/opentsdb-2.x.x/opentsdb-2.x.x_all.deb
. Then simply distribute the package and install it as you regularly would. For example dpkg -i opentsdb-2.0.0_all.deb
.
The Debian package wiil create the following directories:
- /etc/opentsdb - Configuration files
- /tmp/opentsdb - Temporary cache files
- /usr/share/opentsdb - Application files
- /usr/share/opentsdb/bin - The "tsdb" startup script that launches a TSD or commandline tools
- /usr/share/opentsdb/lib - Java JAR library files
- /usr/share/opentsdb/plugins - Location for plugin files and dependencies
- /usr/share/opentsdb/static - Static files for the GUI
- /usr/share/opentsdb/tools - Scripts and other tools
- /var/log/opentsdb - Logs
Installation includes an init script as /etc/init.d/opentsdb
that cat start,stop and restart OpenTSDB. Simply call service opentsdb start
to start the tsd and service opentsdb stop
to stop gracefully shutdown. Note after install, the tsd will not bu running so that you cant edit the configuration file. Edit the config file, then start the TSD.
The Debian package also creates an opentsdb
user and group for the TSD to run under for increased security. TSD only requires write permission to the temporary and logging directories. If you can't use the default locations, please change them in /etc/opentsdb/opentsdb.conf
and /etc/opentsdb/logback.xml
respectively and apply the proper permissions for the opentsdb
user.
If you install OpenTSDB for the first time, you'll need to create the HBase tables using the script located at /usr/share/opentsdb/tools/create_table.sh
. Follow the steps below.
Create Tables
If this is the first time that you are running OpenTSDB with your HBase instance, your first need to create the necessary HBase tables. A simple script is provided to create the proper tables with the ability to anable or disable compression. Execute
env COMPRESSION=NONE HBASE_HOME=/usr/local/webserver/hbase ./src/create_table.sh
where the COMPRESSION
value is either NONE
, LZO
, GZIP
or SNAPPY
. This will create four tables: tsdb
, tsdb-uid
, tsdb-tree
and tsdb-meta
. If you're just evaluating OpenTSDB, don't worry about compression for now. In production and at scale, make sure you use a valid compression library as it will save on storage tremendously.
Start A TSD
OpenTSDB 2.2 works off a configuration file that is shared between the daemon and command line tools. If you compiled from source, copy the ./src/opentsdb.conf
file to a proper directory as documented in Configuration and edit the following, required settings:
- tsd.http.cachedir - Path to write temporary file to
- tsd.http.staticroot - Path to static GUI files found in
./build staticroot
- tsd.storage.hbase.zk_quorum - If HBase and Zookeeper are not running in the same machine, specify the host and part here.
With the config file written, you can start a tsd with the command
./build/tsdb tsd
Alternatively, you can alse use the following commands to create a temporary directory and pass in only command line flags:
tsdtmp=${TMPDIR-'/tmp'}/tsd # For best performance, make sure
mkdir -p "$tsdtmp" # your temporary directory uses tmpfs
./build/tsdb tsd --port=4242 --staticroot=build/staticroot --cachedir="$tsdtmp" --zkquorum=myhost:2181
At this point you can access the TSD's web interface through http://127.0.0.1:4242(if it's running on your local machine)
Note
The cache Directory stores temporary files generated when a graph is requested via the built-in GUI. These files should be purged periodically to free up space. OpenTSDB doesn't clean up after itself at this time but there is a script that should be run as cron at least once a day located at tools/clean_cache.sh
.