influxDB1.8-study notes
1. Installation
1. Execute the command to download and install
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.4.x86_64.rpm
yum localinstall -y influxdb-1.8.4.x86_64.rpm
2. Start and view the service status
systemctl start influxdb && systemctl status influxdb
3. Other common commands
systemctl enable influxdb #设置开机启动
systemctl restart influxdb #重启
2. Use visualization tools InfluxDBStudio
to connect
Note, before connecting:
1. Close the anti-virus software and security manager
2. Close the InfluxDB server 防火墙
or open8086端口
#方法一:关闭防火墙
systemctl stop firewalld
#方法二:开放8086端口
firewall-cmd --zone=public --add-port=8086/tcp --permanent
systemctl restart firewalld
3. Data import and export
Demonstration process: windows服务器
export the influxDB data from above, and then import Linux服务器
the influxDB database
1.Windows environment: influxDB data export-command board enters the installation root folder and executes the export command
1.1 Export syntax
influx_inspect export -datadir "数据存储位置" -waldir "数据交换位置" -out "导出数据文件的文件名" -database 数据库名-start 2023-03-23T01:00:01Z
1.2 Demo sample
influx_inspect export -datadir "C:/influxdb/data" -waldir "C:/influxdb/wal" -out "Test" -database history -start 2023-03-23T01:00:01Z
#3. 参数解读
influx_inspect export
-datadir "C:/influxdb/data" #influxdb 默认的数据存储位置,可以在influxdb.conf里面查看
-waldir "C:/influxdb/wal" #influxdb 默认的数据交换位置,可以在influxdb.conf里面查看
-out "Test" #给导出来的数据文件的取的名字
-database history #指定要导出数据的数据库
-start 2023-03-23T01:00:01Z #指定要导出的数据的起始时间
2. Linux import - script directory execution command
2.1 Grammar
influx -import -path=需导入的文件 -precision=ns
2.2 Demonstration example: first upload the influxDB data file exported in the previous step Test
to any directory of the Linux server, and execute the export command in this directory
influx -import -path=Test -precision=ns
4. Common grammar
1. Query by time range
select * from "表名" where time<='2022-03-23T23:59:59Z' order by time desc