influxdb 导入导出数据

2022/9/7 23:26:26

本文主要是介绍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

 



这篇关于influxdb 导入导出数据的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程