zoukankan      html  css  js  c++  java
  • InfluxDB数据备份与恢复

    InfluxDB数据备份与恢复

    一、基本命令

    命令:influxd backup -database dbName backup_path

    可选参数:
    -retention <retention policy name>
    -shard <shard ID>
    -since <date>

    参数解析:
    retention: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: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: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.

    二、数据备份(必须先备份元数据,再备份数据库中的数据)

    1、本地备份

    1.1 创建本地备份目录
    mkdir influxdb_backup
    cd ./influxdb_backup

    1.2 备份元数据
    influxd backup -database mydatabase -retention autogen ./

    1.3 备份数据库
    influxd backup -database testdb -retention autogen ./

    2、远程备份:假设备份192.168.10.188的数据到192.168.10.199
    注:备份192.168.10.188的数据,需要登录到192.168.10.199执行备份命令

    1.1 创建备份目录
    mkdir backup_188
    cd ./backup_188

    1.2 备份元数据
    influxd backup -host 192.168.10.188:8088 ./

    1.3 备份数据库
    influxd backup -database testdb -host 192.168.10.188:8088 ./

    三、数据恢复(必须先恢复元数据,再恢复数据库中的数据)

    1、恢复元数据

    在188上:
    cd ./influxdb_backup
    influxd restore -metadir /var/lib/influxdb/meta ./

    在199上:
    cd ./backup_188
    influxd restore -metadir /var/lib/influxdb/meta ./

    2、恢复数据库中的数据

    在188上:
    cd ./influxdb_backup
    influxd restore -database testdb -datadir /var/lib/influxdb/data ./

    在199上
    cd ./backup_188
    influxd restore -database testdb -datadir /var/lib/influxdb/data ./


    3、修改目录权限

    chown -R influxdb:influxdb /var/lib/influxdb

    4、重启服务

    service influxdb restart

    注:上述中的/var/lib/influxdb/meta 和 /var/lib/influxdb/data 是InfluxDB执行配置文件中配置的参数,详见/etc/influxdb/influxdb.conf配置文件meta 和 data 配置。
    ————————————————
    版权声明:本文为CSDN博主「XINCHUN2017」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/qian_feifei/article/details/75139665

    热爱世间万物,没例外,没最爱。
  • 相关阅读:
    双击快速打开.ipynb文件的方法
    关于selenium元素点击时出现“element click intercepted :“报错解决办法(亲测可用)
    centos 安装Selenium+Chrome
    最全苹果cms问题解决100
    -scrapy startproject时,报错 from cryptography.hazmat.bindings._openssl import ffi, lib的解决方法
    解决打开fiddle后不能上网
    python学习笔记 pip安装加速&&python淘宝镜像安装包
    lxml.etree类型。不能序列化ElementUnicodeResult
    最值问题
    数列的求和公式
  • 原文地址:https://www.cnblogs.com/guarderming/p/14458212.html
Copyright © 2011-2022 走看看