【问题标题】:adding snapshot to elasticsearch Windows将快照添加到 elasticsearch Windows
【发布时间】:2020-02-19 04:24:17
【问题描述】:

我有两个快照要插入到路径中的 elasticsearch 中:

C:\Users\name\Downloads\book_backup\agg_example
C:\Users\name\Downloads\book_backup\search_example

我在 elasticsearch.yml 中正确列出了

path.repo: ["C:\\Users\\olulo\\Downloads\\book_backup\\agg_example", "C:\\Users\\olulo\\Downloads\\book_backup\\search_example"]

我的 elasticsearch 启动良好,创建新索引也可以。

现在,当我尝试将快照插入到我的 elasticsearch 中以便进行处理时:

curl -XPUT "http://localhost:9200/movies/" -d '{"type":"fs", "settings":{"location":"C:\\Users\\name\\Downloads\\book_backup\\search_example", "compress":true}}'

它给了我:

curl: (1) Protocol "'http" not supported or disabled in libcurl
curl: (3) [globbing] unmatched brace in column 10
curl: (3) [globbing] unmatched close brace/bracket in column 14 

https://www.elastic.co/guide/en/elasticsearch/reference/5.2/modules-snapshots.html 中,他们似乎在位置路径的末尾添加了一个名称,所以我这样做了

curl -XPUT "http://localhost:9200/movies/" -d '{"type":"fs", "settings":{"location":"C:\\Users\\name\\Downloads\\book_backup\\search_example\\test", "compress":true}}'

但仍然给我同样的错误。

https://superuser.com/questions/1322567/http-not-supported-or-disabled-in-libcurl 之后,我已将所有内容更改为双引号:

 curl -XPUT "http://localhost:9200/_snapshot/javacafe" -d "{"type":"fs", "settings":{"location":"C:\\Users\\olulo\\Downloads\\book_backup\\search_example", "compress":true}}"

给我:

{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}

尝试按照

的建议 Content-Type header [application/x-www-form-urlencoded] is not supported on Elasticsearch 添加 curl 选项
    curl -XPUT "localhost:9200/_snapshot/javacafe" -H 'Content-Type: application/json' -d "{
    "type":"fs",
     "settings"{"location":"C:\\Users\\olulo\\Downloads\\book_backup\\search_example\\test", "compress":true}
}"

输出类似的错误并在末尾添加语句:

{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}curl: (6) Could not resolve host: application

已解决: 对于 Windows,您需要在 {} 内的双引号前使用反斜杠:

    curl -XPUT "localhost:9200/_snapshot/javacafe" -H "Content-Type: application/json" -d "{
    \"type\":\"fs\",
     \"settings\"{\"location\":"C:\\Users\\olulo\\Downloads\\book_backup\\search_example\\test", \"compress\":true}
}"

据我了解,windows 使用 \ 来考虑 " 原样。如果是这样,为什么不在所有 curl 命令中也添加反斜杠?

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    试试这个:

    curl -XPUT "localhost:9200/_snapshot/javacafe" -H 'Content-Type: application/json' -d '{
    "type":"fs",
     "settings" : {
       "location":"C:\\Users\\olulo\\Downloads\\book_backup\\search_example\\test",
       "compress":true
      }
    }'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 2017-08-23
      • 2014-06-20
      • 1970-01-01
      • 2017-03-15
      • 2019-10-03
      相关资源
      最近更新 更多