2015-04-06 21:08:54 +00:00
echo "creating database"
curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE foo"
echo "creating retention policy"
curl -G http://localhost:8086/query --data-urlencode "q=CREATE RETENTION POLICY bar ON foo DURATION 1h REPLICATION 3 DEFAULT"
2015-04-23 17:44:16 +00:00
echo '{"database" : "foo", "retentionPolicy" : "bar", "points": [{"name": "cpu", "tags": {"host": "server01"},"time": "2015-01-26T22:01:11.703Z","fields": {"value": 123}}]}' | gzip > foo.json.gz
2015-04-06 21:46:42 +00:00
2015-04-06 21:08:54 +00:00
echo "inserting data"
2015-04-07 15:13:02 +00:00
curl -v -i -H "Content-encoding: gzip" -H "Content-Type: application/json" -X POST -T foo.json.gz http://localhost:8086/write
2015-04-06 21:46:42 +00:00
2015-04-07 15:13:02 +00:00
rm foo.json.gz
2015-04-06 21:08:54 +00:00
echo "querying data with gzip encoding"
curl -v -G --compressed http://localhost:8086/query --data-urlencode "db=foo" --data-urlencode "q=SELECT sum(value) FROM \"foo\".\"bar\".cpu GROUP BY time(1h)"