随笔 - 272  文章 - 0  评论 - 283  阅读 - 142万

使用curl操作InfluxDB

这里列举几个简单的示例代码,更多信息请参考InfluxDB官方文档: https://docs.influxdata.com/influxdb/v1.1/

环境: CentOS6.5_x64
InfluxDB版本:1.1.0

  • 创建数据库

  curl -i -XPOST http://localhost:8086/query --data-urlencode "q=create database testdb"

  • 写入数据

  1、不带时间戳  

  curl -i -XPOST 'http://localhost:8086/write?db=testdb' --data-binary 'students,stuid=s123 score=89'

  2、带时间戳

  curl -i -XPOST 'http://localhost:8086/write?db=testdb' --data-binary 'students,stuid=s123 score=89 1434055562000000000'

  • 查询数据

  1、使用时间字符串(会进行时区转换)

  curl -G 'http://localhost:8086/query' --data-urlencode "db=testdb" --data-urlencode "q=select * from students limit 1"

  2、使用时间戳(不会进行时区转换)

  curl -G 'http://localhost:8086/query' --data-urlencode "epoch=ms" --data-urlencode "db=testdb" --data-urlencode "q=select * from students limit 1"

 

好,就这些了,希望对你有帮助。

本文github地址:

https://github.com/mike-zhang/mikeBlogEssays/blob/master/2017/20170311_使用curl操作InfluxDB.md

欢迎补充 

posted on   Mike_Zhang  阅读(3158)  评论(1编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示