查表:
http://192.168.0.200:8086/query?q=select+*+from+telegraf..cpu
http://192.168.0.200:8086/query?q=select+*+from+mydb..cpu
http://127.0.0.1:8086/query?chunked=true&db=&epoch=ns&q=show+databases
http://127.0.0.1:8086/query?chunked=true&db=mydb&epoch=ns&q=show+measurements
http://127.0.0.1:8086/query?q=select+count(*)+from+mydb..cpu
插入数据:
INSERT cpu,host=serverA,region=us_west value=0.64
INSERT cpu,tagid=A001,host=serverA,region=us_west valuef=0.64,valuei=5,valueb=false,values="abcd1235" 1544065069061293100
按时间段查询数据:
select * from mydb..cpu where time>'2018-12-03 12:40:39' and time
select * from mydb2018..unittest where tagId='t1' and time>'2016-06-01 00:00:00' and time
示例:
select * from TAGDATA where TAGCODE='MZY_KF1:12LI-111004L01C' AND TIME>'2019-01-11 00:00:00' AND TIME
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
1、显示所有数据库:
show databases
2、创建数据库:
create database test
3、使用某个数据库:
use test
4、显示所有表
show measurements
5、新建表和插入数据
新建表没有具体的语法,只是增加第一条数据时,会自动建立表
insert results,hostname=index1 value=1
用户验证:
auth
显示为常规日期格式:
precision rfc3339
-------------------------------
用户管理
a.显示所有用户:
show users
b.新增用户:
--普通用户
create user "user" with password 'user'
--管理员用户
create user "admin" with password 'admin' with all privileges
c.删除用户
drop user "user"
-------------------------------
--查询保存策略
show retention policies on yunhedb
--修改保存策略(2年)
alter retention policy "autogen" on "yunhedb" duration 730d replication 1 default