Backup and recovery of 03-Influxdb
01-Introduction to InfluxDB Please add link description
02-Influxdb permissions management
03-Introduction to backup and recovery of Influxdb
InfluxDB comes with the influxd command, which also supports data backup and recovery. Backup is divided into meta, manifest, and data. The actual operation is described below.
1. Export native data backup
Backup database: monitordb
Backup storage directory location: /data/backup
influxd backup -portable -database monitordb /data/backup
Specify remote host backup parameters · -host 192.168.1.6:8086 · -database monitordb #specifies the database to be backed up, if not specified default all · -portable #Compatible with newer version of influxdb backup file format, officially recommended · -start #Specify the start timestamp of the data to be backed up-start 2015-12-24T08:12:23Z · -end #End timestamp-end 2015-12-31T08:12:23Z2. Export remote host backup
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.manifest3. Recover data
recover local data
influxd restore -portable -db zabbix /data/backup/2018/11/26 05:03:42 Restoring shard 8 live from backup 20181125T205756Z.s8.tar.gz
View recovered data
> 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