fat-jar/fat-jar-readme.md
FatJar is a modified build procedure for OpenTSDB intended to provide a single executable jar that contains all of the java artifacts and resources required to run an OpenTSDB 2.1+ instance. This includes the tsd and all associated command line tools. It does not include the following which remain external dependencies:
With a FatJar build and the above dependencies, it is possible to start an OpenTSDB as simply as:
java -jar opentsdb-2.1.jar
These steps assume building from my current fork repo.
git clone https://github.com/nickman/opentsdb.gitcd opentsdbgit checkout next./build.sh fat-jar-pom.xmlmvn -f fat-jar-pom.xml -Dgpg.skip -DskipTests clean installjava -jar ./target/opentsdb-2.1.0RC1-fat.jar tsdNOTE: FatJar requires maven 3.
ANOTHER NOTE: THe OpenTSDB code base has some non-compliant/missing javadoc tags. If you are compiling with Java 8, the build will fail, so:
<!-- <additionalparam>-Xdoclint:none</additionalparam> -->
(Note that an [unreviewed] aspect of FatJar is the provision of default values for all configuration parameters so the three traditionally required parameters, port, staticroot and cachedir are not required.)
FatJar is accomplished with:
The original motivation for a FatJar build was the simplification of deploying OpenTSDB to multiple "locked-down" environments where it was not feasible to build from source. The addition of RPM and DEB packages for Linux have significantly eased this process, but deployment to non-Linux environments remains a largely manual procedure. While it would be conceivable to implement Solaris and Windows install packages (our 2 pain points), it seemed simpler to adopt the FatJar approach and kill the entire flock of birds with one stone.
The FatJar has been optimized to support simplicity of deployment and configuration, while maintaining complete backward compatability so the modifications are completely additive.
Among some of the benefits we enjoy from the FatJar build:
loadStaticVariables() public.In order of presedence:
The FATJar supports a command line tool to install the UI static content to a specified location:
Usage: java -jar <opentsdb.jar> exportui --d <destination> [--p]
--d=DIR The directory to export the UI content to
--p Create the directory if it does not exist
Example:
java -jar opentsdb-2.1.0RC1.jar exportui --d /tmp/opentsdb/static-content --p
Output:
2015-03-15 16:48:14,988 INFO [main] Main: Created exportui directory [/tmp/opentsdb/static-content]
2015-03-15 16:48:15,258 INFO [main] Main:
===================================================
Static Root Directory:[/tmp/opentsdb/static-content]
Total Files Written:24
Total Bytes Written:1162522
File Write Failures:0
Existing File Newer Than Content:0
Elapsed (ms):270
===================================================
The FatJar supports a slightly modified command line help model. The command help will print the main “menu” of options for the FatJar.
java -jar opentsdb-x.x.x.jar help
Usage: java -jar [opentsdb.jar] [command] [args]
Valid commands:
tsd: Starts a new TSDB instance
fsck: Searches for and optionally fixes corrupted data in a TSDB
import: Imports data from a file into HBase through a TSDB
mkmetric: Creates a new metric
query: Queries time series data from a TSDB
scan: Dumps data straight from HBase
uid: Provides various functions to search or modify information in the tsdb-uid table.
exportui: Exports the OpenTSDB UI static content
Use help <command> for details on a command
Using java -jar opentsdb-x.x.x.jar help <command> for all CLI tools will print the tool's existing usage message. Help for tsd has a couple of additional options. Using the call above, with tsd as the command, the standard usage will be printed. With the additional argument of the keyword extended, the full set of configuration options is printed. Full example here.
An [almost] incidental benefit for users of the Eclipse IDE is that the FatJar source overlay simplifies the setup of a "working-out-of-the-box" Eclipse project using maven. Just do this:
mvn -f fat-jar-pom.xml eclipse:eclipse
Then load up the project in Eclipse and launch net.opentsdb.tools.Main with the parameter tsd".
All at no cost to you.
There's some big changes here. I recognize it's not perfect. Please let me have any feedback. It will not be taken personally, but only to improve OpenTSDB.