惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MongoDB | Blog
MongoDB | Blog
罗磊的独立博客
美团技术团队
B
Blog
量子位
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
博客园 - 聂微东
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
DataBreaches.Net
博客园 - 三生石上(FineUI控件)
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News
Blog — PlanetScale
Blog — PlanetScale
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题

博客园 - Morya

不当心升级到 redis 7.4 怎么回到 valkey8 使用 cert-manager 为 traefik 自动申请和续约 https 证书 traefik学习 k8s 1.28 安装配置 knative-serving v1.15.2 + cert-manager v1.16.1 ssh端口映射玩法 golang echo group 用法的微妙注意点 使用docker最小化部署Git CI环境 使用mailpopbox构建个人独享EmailServer 通过php docker快速验证简单代码 通过k8s service代理外部服务 run gitlab-runner in k8s K8S配置traefik ingressroutes支持TLS ucloud k8s部署traefik的forward-auth 使用nginx构建限频、限速、限并发的应用保护层 macos 更改罗技k810无线键盘的映射 - Morya - 博客园 C++11 thread condition_variable mutex 综合使用 goland scope pattern 设置 Go 1.11 Module 介绍 - Morya hustOJ 添加 golang 支持
Influx cli cheetsheet
Morya · 2021-01-20 · via 博客园 - Morya

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"