本文共 1633 字,大约阅读时间需要 5 分钟。
InfluxDB自带influxd命令同样支持数据备份和恢复,备份的时候分为meta、manifest、数据;下面介绍下实际操作
备份数据库:monitordb
备份存储目录位置:/data/backupinfluxd backup -portable -database monitordb /data/backup
指定远程主机备份参数 • -host 192.168.1.6:8086 • -database monitordb #指定要备份数据库,如不指定默认全部 • -portable #兼容更新版本influxdb的备份文件格式,官方建议使用 • -start#指定需备份数据开始时间戳-start 2015-12-24T08:12:23Z • -end #结束时间戳 -end 2015-12-31T08:12:23Z
influxd backup -portable -database zabbix -host 192.168.1.5:8088 /data/backup
2018/11/24 17:52:58 backing up metastore to /data/backup/meta.002018/11/24 17:52:58 backing up db=zabbix2018/11/24 17:52:58 backing up db=zabbix rp=autogen shard=2 to /data/backup/zabbix.autogen.00002.00 since 0001-01-01T00:00:00Z2018/11/24 17:52:58 backup complete:2018/11/24 17:52:58 /data/backup/20181124T095258Z.meta2018/11/24 17:52:58 /data/backup/20181124T095258Z.s2.tar.gz2018/11/24 17:52:58 /data/backup/20181124T095258Z.manifest
恢复本地数据
influxd restore -portable -db zabbix /data/backup/2018/11/26 05:03:42 Restoring shard 8 live from backup 20181125T205756Z.s8.tar.gz
查看恢复数据
> show serieskey---cpu,host=serverA,region=ca_eastcpu,host=serverA,region=us_west> show measurementsname: measurementsname----cpu> show tag keysname: cputagKey------hostregion> show field keysname: cpufieldKey fieldType-------- ---------value float> select * from zabbix> select * from cpuname: cputime host region value---- ---- ------ -----1543042396476461820 serverA us_west 0.641543042713994239023 serverA ca_east 0.99
转载于:https://blog.51cto.com/nginxs/2323463