Influxdb客户端使用

1. 简介

Influxdb在网络上可以搜索到一个叫InfluxdbStudio的工具,但只能在window下使用,有时在其他系统下做简单数据查询时就比较麻烦,下面以Influxdb V1.8.0版本为例介绍一下其他的方法。

2. 使用influxdb-client工具

influxdb-client是官方的客户端命令行工具,使用起来也比较舒服,现在使用的版本是InfluxDB shell version: 1.8.6

influx -host 1.0.0.5 -port 8086 -username admin -password admin -precision rfc3339
Connected to http://1.0.0.5:8086 version 1.8.0
InfluxDB shell version: 1.8.6
> help
Usage:
connect <host:port> connects to another node specified by host:port
auth prompts for username and password
pretty toggles pretty print for the json format
chunked turns on chunked responses from server
chunk size <size> sets the size of the chunked responses. Set to 0 to reset to the default chunked size
use <db_name> sets current database
format <format> specifies the format of the server responses: json, csv, or column
precision <format> specifies the format of the timestamp: rfc3339, h, m, s, ms, u or ns
consistency <level> sets write consistency level: any, one, quorum, or all
history displays command history
settings outputs the current settings for the shell
clear clears settings such as database or retention policy. run 'clear' for help
exit/quit/ctrl+d quits the influx shell show databases show database names
show series show series information
show measurements show measurement information
show tag keys show tag key information
show field keys show field key information A full list of influxql commands can be found at:
https://docs.influxdata.com/influxdb/latest/query_language/spec/
> use ssdata;
Using database ssdata
> select x,y,z from data02 limit 10;
name: data02
time x y z
---- - - -
2022-09-15T02:02:53Z 123.4562365413 41.7171729195 56.104
2022-09-15T02:02:53.005Z 123.4562365513 41.7171728794 56.102
2022-09-15T02:02:53.01Z 123.4562365313 41.7171729595 56.106
2022-09-15T02:02:53.015Z 123.4562365114 41.7171730295 56.111
2022-09-15T02:02:53.02Z 123.4562365014 41.7171731096 56.116
2022-09-15T02:02:53.025Z 123.4562364815 41.7171731896 56.12
2022-09-15T02:02:53.03Z 123.4562364615 41.7171732697 56.125
2022-09-15T02:02:53.035Z 123.4562364516 41.7171733497 56.129
2022-09-15T02:02:53.04Z 123.4562364316 41.7171734298 56.134
2022-09-15T02:02:53.045Z 123.4562364117 41.7171735098 56.138 `默认是rfc3339的时间格式,修改格式 ` > precision ms
> select x,y,z from data02 limit 10;
name: data02
time x y z
---- - - -
1663207373000 123.4562365413 41.7171729195 56.104
1663207373005 123.4562365513 41.7171728794 56.102
1663207373010 123.4562365313 41.7171729595 56.106
1663207373015 123.4562365114 41.7171730295 56.111
1663207373020 123.4562365014 41.7171731096 56.116
1663207373025 123.4562364815 41.7171731896 56.12
1663207373030 123.4562364615 41.7171732697 56.125
1663207373035 123.4562364516 41.7171733497 56.129
1663207373040 123.4562364316 41.7171734298 56.134
1663207373045 123.4562364117 41.7171735098 56.138

3. 使用浏览器工具

在浏览器内直接输入:
http://1.0.0.5:8086/query?db=ssdata&u=admin&p=admin&epoch=ms&q=select * from data_cpt02 limit 10 支持的查询参数有:https://docs.influxdata.com/influxdb/v2.4/reference/api/influxdb-1x/query/ Query string parameters
u
(Optional) The 1.x username to authenticate the request. See query string authentication. p
(Optional) The 1.x password to authenticate the request. See query string authentication. db
(Required) The database to query data from. This is mapped to an InfluxDB bucket. See Database and retention policy mapping. rp
The retention policy to query data from. This is mapped to an InfluxDB bucket. See Database and retention policy mapping. q
(Required) The InfluxQL query to execute. To execute multiple queries, delimit queries with a semicolon (;). epoch
Return results with Unix timestamps (also known as epoch timestamps) in the specified precision instead of RFC3339 timestamps with nanosecond precision. The following precisions are available: ns - nanoseconds
u or µ - microseconds
ms - milliseconds
s - seconds
m - minutes
h - hours

最新文章

  1. springmvc+mybatis+spring 整合 bootstrap html5
  2. WPF学习之路(十一)布局
  3. Linux:U盘安装Linux系统
  4. void和void*
  5. PTPX中的report 选项
  6. #include #import @class 的一些用法区别
  7. Junit单元测试学习笔记三
  8. 删除所有表数据的sql语句
  9. ios-cocos2d游戏开发基础-CCLayer和Touch事件-开发笔记
  10. SWFLoader交互
  11. HTML5 Canvas图片操作简单实例1
  12. mvc初学controller参数传递感想
  13. 网关协议学习:CGI、FastCGI、WSGI、uWSGI
  14. x264宏块及子块划分方式
  15. C语言的常用字符串操作函数(一)
  16. SQL Server学习之路(五):“增删改查”之“改”
  17. Asp.net MVC在Razor中输出Html的两种方式
  18. Linux系统安装gcc/g++详细过程
  19. Aache的虚拟主机配置虚拟目录
  20. JAVA之旅(二十三)——System,RunTime,Date,Calendar,Math的数学运算

热门文章

  1. pycharm用不了pip
  2. 研究c#异步操作async await状态机的总结
  3. Trie 的一类应用
  4. 首个比较研究表明维持期强柱患者减量续用TNFi疗效尚佳且药费省
  5. Git远程提交的冲突解决
  6. Linux:grep 查找文件内容
  7. Docker中使用Nginx镜像配置HTTPS和HTTP强制使用HTTPS访问(4)
  8. Springboot 拦截器的配置
  9. 新的学习历程-python1 Hello World
  10. react native SectionList组件实现多选