linux下influx客户端使用

influxdb-client

通过
sudo apt-cache search influx
找到了一个客户端工具
influxdb-client - command line interface for InfluxDB
直接安装
sudo apt install influxdb-client

influx 
Connected to http://localhost:8086 version v2.2.0
InfluxDB shell version: 1.6.7~rc0
> 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/
> connect 192.168.0.5:8086
> auth
username: admin
password: 
> show databases
name: databases
name
----
mydata
_internal
graphite
> use mydata
Using database mydata
> select time,a0 from data_tt  limit 10
name: data_tt
time a0
---- --
0    -0.91
0    -0.91
0    -0.91
0    -1.24
0    -1.24
0    -1.25
0    -1.35
0    -1.35
0    -1.35
0    -1.38

还有一种方法就是在浏览器其直接访问:
http://192.168.0.5:8086/query?db=mydata&q=select a0 from data_tt limit 10
在浏览器内会提示输入用户名称和密码,就可以显示查询到的数据

{"results":[{"statement_id":0,"series":[{"name":"data_tt","columns":["time","a0"],"values":[["1970-01-01T00:00:00Z","-0.91"],["1970-01-01T00:00:00Z","-0.91"],["1970-01-01T00:00:00Z","-0.91"],["1970-01-01T00:00:00Z","-1.24"],["1970-01-01T00:00:00Z","-1.24"],["1970-01-01T00:00:00Z","-1.25"],["1970-01-01T00:00:00Z","-1.35"],["1970-01-01T00:00:00Z","-1.35"],["1970-01-01T00:00:00Z","-1.35"],["1970-01-01T00:00:00Z","-1.38"]]}]}]}

posted on   jobgeo  阅读(910)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)

导航

< 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
点击右上角即可分享
微信分享提示