influxDB1.8-学习笔记
一、安装
1.执行指令下载安装
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.启动并查看服务状态
systemctl start influxdb && systemctl status influxdb
3.其他常用指令
systemctl enable influxdb #设置开机启动
systemctl restart influxdb #重启
二、使用可视化工具InfluxDBStudio
连接
注意,连接前:
1.关闭杀毒软件及安全管家
2.关闭InfluxDB服务器防火墙
或开放8086端口
#方法一:关闭防火墙
systemctl stop firewalld
#方法二:开放8086端口
firewall-cmd --zone=public --add-port=8086/tcp --permanent
systemctl restart firewalld
三、数据导入导出
演示过程:从windows服务器
上将influxDB数据导出,然后导入Linux服务器
influxDB数据库
1.Windows环境: influxDB数据导出-指令板进入安装根文件夹,执行导出指令
1.1 导出语法
influx_inspect export -datadir "数据存储位置" -waldir "数据交换位置" -out "导出数据文件的文件名" -database 数据库名-start 2023-03-23T01:00:01Z
1.2 演示样例
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导入-脚本目录执行指令
2.1 语法
influx -import -path=需导入的文件 -precision=ns
2.2 演示样例:先将上一步导出来的influxDB数据文件Test
上传至Linux服务器任意目录,在该目录执行导出指令
influx -import -path=Test -precision=ns
四、常用语法
1.根据时间范围查询
select * from "表名" where time<='2022-03-23T23:59:59Z' order by time desc