-
Notifications
You must be signed in to change notification settings - Fork 39
UpandRunning
This guide will walk you through the steps to setup a simple instance of Newts running on a single node.
To complete the steps in this guide, you will need a Unix-like environment with:
- Git
- wget
- tar
- sed
- Maven (>= 3)
- Java 7 (OpenJDK, Oracle, etc)
Open a new terminal and:
Substitute ${version}
below with the version of Cassandra to download. The
latest 2.0.x version of Cassandra is recommended (version 2.0.10 at the time of
this writing).
# Terminal 1
wget http://www.apache.org/dist/cassandra/${version}/apache-cassandra-${version}-bin.tar.gz
tar zxvf apache-cassandra-${version}-bin.tar.gz
cd apache-cassandra-${version}/
This assumes a scratch install of Cassandra in order to test out Newts, so
issue the following commands to modify the config so that data is stored
in the /tmp/
directory. Do not do this for a system you intend to run
in production.
sed -i "s/var\/lib/tmp/g" conf/cassandra.yaml
sed -i "s/var\/log/tmp/g" conf/log4j-server.properties
bin/cassandra -f
At this point, if there were no exceptions, Cassandra will be running in the foreground, with log output printed to the console. Open a new console, and enter the following:
# Terminal 2
git clone https://github.com/OpenNMS/newts.git
NEWTSSRC=`pwd`/newts
cd $NEWTSSRC
mvn package -PsuperJar
This downloads and builds the Newts source, and installs it to your Maven repository (usually ~/.m2/repository
).
Next, we'll initialize (create the Newts schema), and start the REST endpoint:
# Terminal 2
cd $NEWTSSRC/rest
java -jar target/newts-rest-1.1.0-SNAPSHOT.jar init example-config.yaml
java -jar target/newts-rest-1.1.0-SNAPSHOT.jar server example-config.yaml
Note: During initialization, SLF4J may complain about logger implementations, you can safely ignore this.
Note: During Newts server startup, you may see warnings about missing compression libraries from the Cassandra driver, you can safely ignore these.
$NEWTS/rest/samples.txt
contains samples in the JSON representation that Newts expects. Importing these samples is a quick way to be sure everything is working.
# Terminal 3
curl -D - -X POST -H "Content-Type: application/json" -d @samples.txt http://0.0.0.0:8080/samples
curl -D - -X GET 'http://0.0.0.0:8080/samples/%2Flocalhost%2Fchassis%2Ftemps?start=1998-07-09T12:05:00-0500&end=1998-07-09T13:15:00-0500'; echo
Why not try the Global Summary of Day (weather data) demo?
- Getting Started
- Data Model
- Running a REST Service
- Using the Java API
- Aggregation
- Search
- API Reference * Java * REST
- Hacking Newts