influxdb 导入导出数据
导入导出命令
# 导出,两个dir目录在influxdb.conf中有配置 influx_inspect export -datadir "/var/lib/influxdb/data" -waldir "/var/lib/influxdb/wal" -out "/data/test123456" -database lcx # 导入 influx -import -path=/data/lcx123
导出数据结构
# INFLUXDB EXPORT: 1677-09-21T08:18:26+08:05 - 2262-04-12T07:47:16+08:00 # DDL CREATE DATABASE lcx WITH NAME autogen # DML # CONTEXT-DATABASE:lcx # CONTEXT-RETENTION-POLICY:autogen # writing tsm data analog,identity=station-998-625 11="0" 1661305890000000000 analog,identity=station-998-625 11="0" 1661307160000000000 analog,identity=station-998-625 11="0" 1661307170000000000 analog,identity=station-998-625 11="0" 1661307180000000000 analog,identity=station-998-625 11="0" 1661307190000000000 analog,identity=station-998-625 11="0" 1661307200000000000 analog,identity=station-998-625 11="0" 1661307210000000000 analog,identity=station-998-625 11="0" 1661307220000000000 analog,identity=station-998-625 11="0" 1661307230000000000 analog,identity=station-998-625 11="0" 1661307240000000000
导入的数据结构
前面三行我本来以为可以删除的,因为看样子是一个注释,但测试后发现不加会出错
大致看一下,第一行表示下面的语句是DML 非 DDL
第二行用来指定database,我这里用的database是 lcx
# DML # CONTEXT-DATABASE:lcx # CONTEXT-RETENTION-POLICY:autogen device,identity=station-998-625 B=23 1661305890000000000 device,identity=station-998-625 B=23 1661307160000000000 device,identity=station-998-625 B=23 1661307170000000000 device,identity=station-998-625 B=23 1661307180000000000 device,identity=station-998-625 B=23 1661307190000000000 device,identity=station-998-625 B=23 1661307200000000000 device,identity=station-998-625 B=23 1661307210000000000 device,identity=station-998-625 B=23 1661307220000000000 device,identity=station-998-625 B=23 1661307230000000000 device,identity=station-998-625 B=23 1661307240000000000 device,identity=station-998-625 B=23 1661307250000000000 device,identity=station-998-625 B=23 1661307260000000000 device,identity=station-998-625 B=23 1661307270000000000 device,identity=station-998-625 B=23 1661307280000000000 device,identity=station-998-625 B=23 1661307290000000000 device,identity=station-998-625 B=23 1661307300000000000 device,identity=station-998-625 B=23 1661307310000000000