zoukankan      html  css  js  c++  java
  • elasticsearch备份与恢复

    备注:以下代码在kibana插件下运行:

    # 创建一个备份用的仓库
    # type:fs文件系统
    # 支持Shared filesystem, Amazon S3, HDFS和Azure #Cloud
    # location备份目录

     PUT /_snapshot/my_backup
    {
         "type": "fs",
         "settings": {
             "location": "c:/mount/backups/my_backup"
         }
    }
    

      

    # 修改备份仓库属性
    # max——snapshot_bytes_per_sec,创建快照速度
    # max_restore_bytes_per_sec,还原快照速度

    POST /_snapshot/my_backup/
    {
        "type": "fs",
        "settings": {
            "location": "/mount/backups/my_backup",
            "max_snapshot_bytes_per_sec" : "50mb",
            "max_restore_bytes_per_sec" : "50mb"
        }
    }        
    

      

    # 开始备份
    #wait_for_completion等待完成参数,如果没有,则后台完成

    PUT /_snapshot/my_backup/snapshot_1?wait_for_completion=true
    

      

    # 查看快照

    GET /_snapshot/my_backup/snapshot_1
    

      

    # 查看所有快照

    GET /_snapshot/my_backup/_all
    

      

    # 快照详细信息

    GET /_snapshot/my_backup/snapshot_1/_status


    # 删除备份

    DELETE /_snapshot/my_backup/snapshot_1
    

      

    # 恢复snapshot_1里的全部索引

    POST /_snapshot/my_backup/snapshot_1/_restore


    # 恢复详细参数设置
    # 参数indices 设置只恢复index_1索引,
    # 参数rename_pattern 和rename_replacement 用来正则匹配要恢复的索引,并且重命名。
    # 和备份一样,api会立刻返回值,然后在后台执行恢复,使用wait_for_completion 标记强制
    # 同步执行

    POST /_snapshot/my_backup/snapshot_1/_restore
    {
        "indices": "index_1",
        "rename_pattern": "index_(.+)",
        "rename_replacement": "restored_index_$1"
    }
    

      

    # 查看恢复的状态

    GET /_recovery/restored_index_3
    GET /_recovery/
    

      

    # 取消恢复过程不管是正在备份,还是备份完成

    DELETE /restored_index_3
    

      

  • 相关阅读:
    JedisConnectionException: java.net.ConnectException: Connection refused
    启动tomcat时 错误: 代理抛出异常 : java.rmi.server.ExportException: Port already in use: 1099的解决办法
    JAVA 判断一个字符串是不是一个合法的日期格式
    升级openssl
    Linux操作路由
    Linux的用户行为审计
    升级gdb
    Linux的运行级别
    sudo的用法
    Linux缓存清理
  • 原文地址:https://www.cnblogs.com/chenzongyan/p/9329057.html
Copyright © 2011-2022 走看看