Influxdb数据的导入与导出(1.8->1.7)

背景

  • 测试influxdb1.8的数据可否导入influxdb1.7中
软件
  • 导出:win版的influxdb1.8
  • 导入:华为云GaussDB NoSQL(for influx)1.7

导出步骤

1.先配置好win下的influxdb配置文件并通过配置文件启动

influxd -config influxdb.conf

2.在系统权限下打开cmd窗口,切换到influxdb的安装目录下
3.执行下面命令:

D:\DataBase\influxdb-1.8.3_windows_amd64\influxdb-1.8.3-1>influx_inspect export -datadir "D:/DataBase/influxdb-1.8.3_windows_amd64/data" -waldir "D:/DataBase/influxdb-1.8.3_windows_amd64/wal" -out "test-test" -database test -start 2019-07-2
解析:influx_inspect export 
		-datadir "/data/influxdb/data" # 勿动,influxdb 默认的数据存储位置
		-waldir "/data/influxdb/wal"   # 勿动,influxdb 默认的数据交换位置
		-out "telemetry_vcdu_time"     # 导出数据文件的文件名
		-database telemetry_vcdu_time  # 指定要导出数据的数据库
		-start 2019-07-21T08:00:01Z    # 指定要导出的数据的起始时间

4.执行完看到如下窗口即导出成功
在这里插入图片描述

导入步骤

1.登录云服务器(CentOs7),上传导出的文件到云服务器上
2.将InfluxDB客户端安装包上传到弹性云服务器,解压客户端工具包,并打开所在目录。

tar -xzf influxdb-1.7.9-static_linux_amd64.tar.gz

3.在root权限执行以下命令:

./influx -ssl -unsafeSsl -host 191.1.1.1 -port 8086 -username xxxxx -password xxxxxxx  -import -path=/home/temp/test-test -precision=ns
解析:influx -import -path=telemetry_sat_time -precision=ns
	命令解释
	influx 
		-import    # 无参,勿动
		-path=telemetry_sat_time # 指定导入数据的文件
		-precision=ns # 指定导入数据的时间精度

4.见到下图即成功导出

在这里插入图片描述

常用influx客户端命令:

Usage of influx:
  -version
       Display the version and exit.
  -host 'host name'
       Host to connect to.
  -port 'port #'
       Port to connect to.
  -socket 'unix domain socket'
       Unix socket to connect to.
  -database 'database name'
       Database to connect to the server.
  -password 'password'
      Password to connect to the server.  Leaving blank will prompt for password (--password '').
  -username 'username'
       Username to connect to the server.
  -ssl
        Use https for requests.
  -unsafeSsl
        Set this when connecting to the cluster using https and not use SSL verification.
  -execute 'command'
       Execute command and quit.
  -type 'influxql|flux'
       Type specifies the query language for executing commands or when invoking the REPL.
  -format 'json|csv|column'
       Format specifies the format of the server responses:  json, csv, or column.
  -precision 'rfc3339|h|m|s|ms|u|ns'
       Precision specifies the format of the timestamp:  rfc3339, h, m, s, ms, u or ns.
  -consistency 'any|one|quorum|all'
       Set write consistency level: any, one, quorum, or all
  -pretty
       Turns on pretty print for the json format.
  -import
       Import a previous database export from file
  -pps
       How many points per second the import will allow.  By default it is zero and will not throttle importing.
  -path
       Path to file to import
  -compressed
       Set to true if the import file is compressed

Examples:

    # Use influx in a non-interactive mode to query the database "metrics" and pretty print json:
    $ influx -database 'metrics' -execute 'select * from cpu' -format 'json' -pretty

    # Connect to a specific database on startup and set database context:
    $ influx -database 'metrics' -host 'localhost' -port '8086'

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值