uokadaの見逃し三振は嫌いです

ここで述べられていることは私の個人的な意見に基づくものであり、私が所属する組織には一切の関係はありません。

influxdbをCLIから利用する

influxdb ver0.9を触っているけど、いろいろ変わりすぎているので公式ドキュメントしか頼っている。。。

ver0.6ぐらい触った時はこんな挙動だった?って思うことが沢山w

とりあえず、curlからデータを挿入してみる。

Write Syntax | InfluxDB

Specify Non-nanosecond Timestamps

Use the precision=[n,u,ms,s,m,h] query string parameter to supply a precision for the timestamps.

All timestamps are assumed to be Unix nanoseconds unless otherwise specified. If you provide timestamps in any unit other than nanoseconds, you must supply the appropriate precision in the URL query string. Use n, u, ms, s, m, and h for nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively.

precisionパラメータでデータの精度を決めることが出来る。今回はテストなのでそこまで精度が必要ないので秒単位でデータを登録していく。

% curl -i -X POST 'http://localhost:8086/write?db=mydb&precision=s' \
  -d 'cput,host=server01,region=us-west value=0.64 1434055566'
HTTP/1.1 204 No Content
Request-Id: 5fa0e3de-8566-11e5-802b-000000000000
X-Influxdb-Version: 0.9.4.1
Date: Sat, 07 Nov 2015 15:44:04 GMT

バッチでデータを挿入することも出来るので大量データを挿入する場合はこっちでデータを挿入するのがベター。 ファイルのフォーマットは単発でデータを挿入する場合と一緒。

Write a Batch of Points with curl

You can also pass a file using the @ flag. The file can contain a batch of points, one per line. Points > must be separated by newline characters \n. Batches should be 5000 points or fewer for best performance.

これでもダメならUDPでデータ挿入なのかな。 Go製なのでパフォーマンスはかなり出るからこれを使うのはかなり先になりそう。