influxdb 筆記: 備份/恢復

G8bao7發表於2016-11-29



##
### 備份
# 備份 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部落格 ” ,連結:http://blog.itpub.net/26250550/viewspace-2129320/,如需轉載,請註明出處,否則將追究法律責任。

相關文章