查表:sql
http://192.168.0.200:8086/query?q=select+*+from+telegraf..cpu數據庫
http://192.168.0.200:8086/query?q=select+*+from+mydb..cpuspa
http://127.0.0.1:8086/query?chunked=true&db=&epoch=ns&q=show+databasescode
http://127.0.0.1:8086/query?chunked=true&db=mydb&epoch=ns&q=show+measurementsserver
http://127.0.0.1:8086/query?q=select+count(*)+from+mydb..cpuci
插入數據:rem
INSERT cpu,host=serverA,region=us_west value=0.64
string
INSERT cpu,tagid=A001,host=serverA,region=us_west valuef=0.64,valuei=5,valueb=false,values="abcd1235" 1544065069061293100it
按時間段查詢數據: io
select * from mydb..cpu where time>'2018-12-03 12:40:39' and time<'2018-12-03 12:40:41'
select * from mydb2018..unittest where tagId='t1' and time>'2016-06-01 00:00:00' and time<'2016-06-01 00:01:00'
示例:
select * from TAGDATA where TAGCODE='MZY_KF1:12LI-111004L01C' AND TIME>'2019-01-11 00:00:00' AND TIME<'2019-01-11 00:10:00'
http://127.0.0.1:8086/query?chunked=true&db=yunhedb&epoch=ns&q=select+%2A+from+TAGDATA+where+TAGCODE%3D%27MZY_KF1%3A12LI-111004L01C%27+AND+TIME%3E%272019-01-11+00%3A00%3A00%27+AND+TIME%3C%272019-01-11+00%3A10%3A00%27
刪除表:
drop measurement mydb
一、顯示全部數據庫:
show databases
二、建立數據庫:
create database test
三、使用某個數據庫:
use test
四、顯示全部表
show measurements
五、新建表和插入數據
新建表沒有具體的語法,只是增長第一條數據時,會自動創建表
insert results,hostname=index1 value=1
用戶驗證:
auth
顯示爲常規日期格式:
precision rfc3339
-------------------------------
用戶管理
a.顯示全部用戶:
show users
b.新增用戶:
c.刪除用戶
drop user "user"
-------------------------------
--查詢保存策略
show retention policies on yunhedb
--修改保存策略(2年)alter retention policy "autogen" on "yunhedb" duration 730d replication 1 default