码迷,mamicode.com
首页 > 其他好文 > 详细

Influx cli cheetsheet

时间:2021-01-21 10:44:35      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:time   create   ati   sele   line   roo   name   password   column   

Influx cli cheetsheet

-- 管理用户
CREATE USER "hsj" WITH PASSWORD ‘hsj‘
CREATE USER "zx" WITH PASSWORD ‘zx‘

--- 创建admin账号
CREATE USER "todd" WITH PASSWORD ‘123456‘ WITH ALL PRIVILEGES

-- 管理用户权限
grant ALL on "online_peak" to "hsj"
GRANT ALL PRIVILEGES TO "todd"

revoke all on "onlinecount" from "hsj"
revoke all on "onlinecount" from "zx"
revoke all on "_internal" from "zx"
revoke all on "_internal" from "hsj"

-- 管理db
create database "online_peak"
drop database "online_peak"

-- 管理 RETENTION POLICY
CREATE RETENTION POLICY "two_hours" on "online_peak" DURATION 2h REPLICATION 1 [DEFAULT] 
--- 给定default参数,则把当前RP设置为db的默认rp,否则只创建,不设置default

-- 管理 CONTINUOUS QUERY
CREATE CONTINUOUS QUERY "cq_team_peak" ON "onlinecount" BEGIN select sum(all_user) as max_user, team_id  into onlinecount.one_month.team_peak_minute  from room_stat  group by time(5m), team_id  END

CREATE CONTINUOUS QUERY "cq_team_peak_5m" ON "onlinecount" BEGIN select sum(all_user) as max_user,team_id  into onlinecount..team_peak_5m  from room_stat  group by time(5m),team_id END

-- 其它配置
precision rfc3339  -- 设置时间显示格式为rfc3339  --> 2021-01-20T10:17:00Z

-- 查看当前配置
settings
--------          --------
Host              172.16.210.109:8086
Username          zx
Database          zx
RetentionPolicy
Pretty            false
Format            column
Write Consistency all
Chunked           true
Chunk Size        0


-- 查看各种参数
show MEASUREMENTS
show CONTINUOUS QUERIES
show RETENTION POLICIES

-- 从一个表导出数据到其它位置
-- 导出到另外一个measurement
-- 导出到另外 rp 下 measurements
-- 导出到别的 db 下
select sum(all_user) as "team_peak" from room_stat_1m where (time >= ‘2021-01-20T06:10:00Z‘) and (time < ‘2021-01-20T07:10:00Z‘ ) and team_id = ‘1005‘ limit 30

select sum("all_user") as "team_peak" into  "team_stat_1m"  from "room_stat_1m" where (time >= ‘2021-01-20T06:10:00Z‘) and (time < ‘2021-01-20T07:10:00Z‘ ) group by time(1m), "team_id" 

Influx cli cheetsheet

标签:time   create   ati   sele   line   roo   name   password   column   

原文地址:https://www.cnblogs.com/morya/p/14304593.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!