ITPub博客

首页 > 应用开发 > IT综合 > influxdb 笔记: 备份/恢复

influxdb 笔记: 备份/恢复

原创 IT综合 作者:G8bao7 时间:2016-11-29 17:07:18 0 删除 编辑


https://docs.influxdata.com/influxdb/v0.13/administration/backup_and_restore/
##
### 备份
# 备份 metastore, InfluxDB’s metastore contains internal information about the status of the system:
#  including: user information, database/shard metadata, and which retention policies are enabled
influxd backup /path/to/backup

# 备份 data, -database
influxd backup -database mydatabase /path/to/backup
-retention <retention policy name> 
This flag can be used to backup a specific retention policy. 
For more information on retention policies, please see here. If not specified, all retention policies will be backed up.
-shard <shard ID>
This flag can be used to backup a specific shard ID. 
To see which shards are available, you can run the command SHOW SHARDS using the InfluxDB query language. If not specified, all shards will be backed up.
-since <date>  ## 增备使用,相当不错
This flag can be used to create a backup since a specific date, where the date must be in RFC3339 format (for example, 2015-12-24T08:12:23Z). 
This flag is important if you would like to take incremental backups of your database. If not specified, all timeranges within the database will be backed up.

## Example
# 将数据库'telegraf'从'2016-2-1'后的数据备份到目录/tmp/backup
$ influxd backup -database telegraf  -since 2016-02-01T00:00:00Z /tmp/backup
2016/02/01 18:02:36 backing up rp=default since 2016-02-01 00:00:00 +0000 UTC
2016/02/01 18:02:36 backing up metastore to /tmp/backup/meta.01
2016/02/01 18:02:36 backing up db=telegraf rp=default shard=2 to /tmp/backup/telegraf.default.00002.01 since 2016-02-01 00:00:00 +0000 UTC
2016/02/01 18:02:36 backup complete


# 远程备份
influxd backup -database mydatabase -host 192.168.1.3:8088 /tmp/mysnapshot

### 恢复
influxd restore /tmp/backup
-metadir <path to meta directory>
-datadir <path to data directory>
-database <database>
-retention <retention policy>
-shard <shard id>

必须先恢复 metastore,再恢复数据

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26250550/viewspace-2129320/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-11-04

  • 博文量
    496
  • 访问量
    1258265