安装
参考CentOS 7下InfluxDB部署与使用入门 - Ken的杂谈在我的vagrant虚拟机(CentOS 7)中成功安装了influxdb 1.8
[vagrant@bin9wei001 apps]$ influxd version
InfluxDB v1.8.10 (git: 1.8 688e697c51fd)
influx CLI
[vagrant@bin9wei001 apps]$ influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> SHOW USERS
user admin
---- -----
> CREATE USER influx WITH PASSWORD 'influx' WITH ALL PRIVILEGES
> SHOW USERS
user admin
---- -----
influx true
> CREATE DATABASE test
> SHOW DATABASES
name: databases
name
----
_internal
test
> USE test
Using database test
> SHOW MEASUREMENTS
> INSERT cpu,host=192.168.1.1 load=0.1,usage=0.2
> SELECT * FROM "cpu"
name: cpu
time host load usage
---- ---- ---- -----
1637170612184790139 192.168.1.1 0.1 0.2
HTTP API
在vagrant虚拟机中访问localhost
[vagrant@bin9wei001 apps]$ curl -G http://localhost:8086/query?db=test --data-urlencode "q=SELECT * FROM \"cpu\""
{"results":[{"statement_id":0,"series":[{"name":"cpu","columns":["time","host","load","usage"],"values":[["2021-11-17T17:50:14.822252876Z","192.168.1.1",0.1,0.2]]}]}]}
在windows主机中访问虚拟机上的influx
C:\Users\bin9w>curl -G http://192.168.33.22:8086/query?db=test --data-urlencode "q=SHOW MEASUREMENTS"
{"results":[{"statement_id":0,"series":[{"name":"measurements","columns":["name"],"values":[["cpu"]]}]}]}
参考
CentOS 7下InfluxDB部署与使用入门 - Ken的杂谈
Install InfluxDB OSS | InfluxDB OSS 1.8 Documentation
|