influxdbの簡単なインストール/構成/使用
6226 ワード
データソースはinfluxdb-pythonによってinfluxdbに書き込まれ、grafanaが表示されます.
インストール
for debian 9 strech version、これで最新バージョンになります.
コンフィギュレーション
デフォルトの構成をファイルにエクスポートし
ルール#ルール#
Downsampling and data retention
retention policy
データの保存期間
continuous query
サンプリングの頻度
実際の使用方法の説明
continuous query
org_streamは30 m分の周波数サンプリングでorg_を挿入stream_30 m、group by time(30 m)は、30分ごとに実行されます.
select * from org_stream where time >= ‘2017-11-01T00:00:00Z’
CLI
時間pretty
influxに入ると、入力
backing and restore
インストール
for debian 9 strech version、これで最新バージョンになります.
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
test $VERSION_ID = "9" && echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update && sudo apt-get install influxdb
sudo service influxdb start
コンフィギュレーション
デフォルトの構成をファイルにエクスポートし
influxd -config /etc/influxdb/influxdb.conf
、
、構成情報を変更し、認証を開きます.[http]
enabled = true
bind-address = ":8086"
auth-enabled = true # ✨
ルール#ルール#
Downsampling and data retention
retention policy
データの保存期間
continuous query
サンプリングの頻度
4. Create the CQ
Now that we’ve set up our RPs, we want to create a CQ that will automatically and periodically downsample the ten-second resolution data to the 30-minute resolution, and store those results in a different measurement with a different retention policy.
Use the CREATE CONTINUOUS QUERY statement to generate a CQ:
> CREATE CONTINUOUS QUERY "cq_30m" ON "food_data" BEGIN
SELECT mean("website") AS "mean_website",mean("phone") AS "mean_phone"
INTO "a_year"."downsampled_orders"
FROM "orders"
GROUP BY time(30m)
END
That query creates a CQ called cq_30m in the database food_data. cq_30m tells InfluxDB to calculate the 30-minute average of the two fields website and phone in the measurement orders and in the DEFAULT RP two_hours. It also tells InfluxDB to write those results to the measurement downsampled_orders in the retention policy a_year with the field keys mean_website and mean_phone. InfluxDB will run this query every 30 minutes for the previous 30 minutes.
Note: Notice that we fully qualify (that is, we use the syntax "" ."" ) the measurement in the INTO clause. InfluxDB requires that syntax to write data to an RP other than the DEFAULT RP.
実際の使用方法の説明
continuous query
CREATE CONTINUOUS QUERY org_stream_30m ON testdb BEGIN SELECT sum(value) INTO org_stream_30m FROM org_stream GROUP BY time(30m) END
org_streamは30 m分の周波数サンプリングでorg_を挿入stream_30 m、group by time(30 m)は、30分ごとに実行されます.
select * from org_stream where time >= ‘2017-11-01T00:00:00Z’
CLI
時間pretty
influxに入ると、入力
precision rfc3339
バックアップbacking and restore