免费注册
文档中心
Hadoop HDFS Repository Plugin
  •  ● 通过REST API定义hdfs存储库的配置:

     
    PUT /_snapshot/my_hdfs_repository 
    {   
     "type": "hdfs",   
     "settings": {     
       "uri": "hdfs://namenode:8020/",     
       "path": "elasticsearch/respositories/my_hdfs_repository"   
     } 
    # uri: hdfs的地址,例如:"hdfs://<host>:<port>/" 
    # path: 数据存储/加载的文件系统中的文件路径,例如:"path/to/file"

    创建成功,可以获取hdfs仓库信息:

     GET /_snapshot/my_hdfs_repository

    示例:

     
    {   
     "my_hdfs_repository": {     
       "type": "hdfs",     
       "settings": {       
          "path": "elasticsearch/respositories/my_hdfs_repository",       
          "uri": "hdfs://namenode:8020/"     
          }   
       } 
    }

    ● 创建快照:

     
    PUT /_snapshot/my_hdfs_repository/snapshot_1 
    {   
      "indices": "index_1,index_2",   
      "ignore_unavailable": true,   
      "include_global_state": false 
    }

    创建成功,可以获取快照信息:

     GET /_snapshot/my_hdfs_repository/snapshot_1

    示例:

     
    {   
      "snapshots": [     
        {       
        "snapshot": "snapshot_1",       
        "uuid": "yr9T6jtLTCeVFRoNGN-9Lw",       
        "version_id": 5050199,       
        "version": "5.5.1",       
        "indices": [         
            ".kibana",         
            "ucloud"       
        ],       
        "state": "SUCCESS",       
        "start_time": "2018-02-01T08:13:26.128Z",       
        "start_time_in_millis": 1517472806128,       
        "end_time": "2018-02-01T08:13:28.870Z",       
        "end_time_in_millis": 1517472808870,       
        "duration_in_millis": 2742,       
        "failures": [],       
        "shards": {         
            "total": 6,         
            "failed": 0,         
            "successful": 6       
            }     
         }   
      ] 
    }

    ● 删除快照:

    Asd

     DELETE /_snapshot/my_hdfs_repository/snapshot_1

    ● 快照恢复:

     POST /_snapshot/my_hdfs_repository/snapshot_1/_restore

    注意: 若集群中已经存在需要快照恢复的索引并且为 open 状态,需要使用 _close API先关闭该索引,示例:

     POST /.kibana/_close

    更详细插件使用请参考 Hadoop HDFS Repository Plugin:

    https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html#_repository_plugins