标签:mon 文件 操作 添加 value 新版 float select ast
InfluxDB自带influxd命令同样支持数据备份和恢复,备份的时候分为meta、manifest、数据;下面介绍下实际操作
备份数据库:monitordb
备份存储目录位置:/data/backup
influxd backup -portable -database monitordb /data/backup
指定远程主机备份参数
? -host 192.168.1.6:8086
? -database monitordb #指定要备份数据库,如不指定默认全部
? -portable #兼容更新版本influxdb的备份文件格式,官方建议使用
? ?-start <timestamp>#指定需备份数据开始时间戳-start 2015-12-24T08:12:23Z
? -end <timestamp>? #结束时间戳 -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.00
2018/11/24 17:52:58 backing up db=zabbix
2018/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:00Z
2018/11/24 17:52:58 backup complete:
2018/11/24 17:52:58 /data/backup/20181124T095258Z.meta
2018/11/24 17:52:58 /data/backup/20181124T095258Z.s2.tar.gz
2018/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 series
key
---
cpu,host=serverA,region=ca_east
cpu,host=serverA,region=us_west
> show measurements
name: measurements
name
----
cpu
> show tag keys
name: cpu
tagKey
------
host
region
> show field keys
name: cpu
fieldKey fieldType
-------- ---------
value float
> select * from zabbix
> select * from cpu
name: cpu
time host region value
---- ---- ------ -----
1543042396476461820 serverA us_west 0.64
1543042713994239023 serverA ca_east 0.99
标签:mon 文件 操作 添加 value 新版 float select ast
原文地址:http://blog.51cto.com/nginxs/2323463