Create a docker network to bridge containers
docker network create mynetwork
Start StreamSets like this:
docker run -it -p 18630:18630 -d --name sdc --network mynetwork streamsets/datacollector
The start opentsdb+hbase like this:
docker run -dp 4242:4242 --name hbase --network mynetwork petergrace/opentsdb-docker
Wait a few minutes for the OpenTSDB hbase container to start. Validate that opentsdb is started by doing telnet localhost 4242
, and then inside the telnet session type stats
. If you don't get a telnet connection error, then opentsdb is ready. You can also validate opentsdb like this:
Write values to a metric
for i in `seq 1 5`; do curl -X POST --data '{"metric": "sys.ian.test", "timestamp": '`date +%s`',"value": '$RANDOM',"tags": {"host": "localhost"}}' "http://hbase:4242/api/put"; sleep 1; done
Read values from a metric:
wget -q -O- "http://hbase:4242/api/query?start=10d-ago&m=avg:sys.ian.test"
Then copy test data file to SDC like this:
docker cp mqtt.json sdc:/tmp/mqtt.json
And since that data file is huge, write just one line at a time to a file we'll tail in streamsets:
docker exec -it --user root sdc /bin/bash
cat /tmp/mqtt.json | while read line; do echo $line >> /tmp/here.json; sleep 1; done