2014-11-25 26 views
2

我使用Elasticsearch 1.4和Ubuntu 12.04.3 LTS.Trying創建本地elasticsearch快照註冊一個快照庫。我指的這個website不能在Elasticsearch

本網站的步驟是在Windows Elasticsearch工作的罰款。如果我在Ubuntu Elasticsearch上註冊存儲庫。它在消息下面發射。

此查詢我跑什麼

curl -XPUT http://xx.xx.xx.xx:9200/_snapshot/es_snap -d '{ 
    "type": "fs", 
    "settings": { 
    "location": "/mount/backups/my_backup" 
    } 
}' 

我得到這個響應。

{ 
    "error":"RepositoryException[[es_snap] failed to create repository]; 
      nested: CreationException[Guice creation errors:\n\n1) Error injecting constructor, org.elasticsearch.common.blobstore.BlobStoreException: 
      Failed to create directory at [ 
       D:/data/es_snapshot_bkup/es_snapshot_repo]\n 
       at org.elasticsearch.repositories.fs.FsRepository.<init>(Unknown Source)\n 
       while locating org.elasticsearch.repositories.fs.FsRepository\n 
       while locating org.elasticsearch.repositories.Repository\n\n1 error 
      ]; 
      nested: BlobStoreException[Failed to create directory at [/mount/backups/my_backup]]; ", 
    "status":500 
} 

回答

7
  1. 首先創建一個備份文件夾(通常該文件夾中創建用戶的主文件夾)

    mkdir ~/backup 
    
  2. 該文件夾給予許可

    chmod 777 ~/backup 
    
  3. 創建一個存儲庫(Repository是代表你的路徑)

    curl -XPUT http://xx.xx.xx.xx:9200/_snapshot/es_snap -d 
    '{"type":"fs","settings":{"location":"home/user/backup" 
    ,"compress":true}}' 
    
  4. 快照

    curl -XPUT "http://xx.xx.xx.xx:9200/_snapshot/en_snap/snapshot_1" -d 
    '{"indices":["index1","index2","index3"],"ignore_unavailable":true, 
    "include_global_state": false,}' 
    
  5. 恢復

    curl -XPOST "http://xx.xx.xx.xx:9200/_snapshot/es_snap/snapshot_1/_restore" -d 
    '{"indices":["index1","index2"],"ignore_unavailable":true, 
    "include_global_state": false}' 
    
+0

我已經有了這個解決方案的兄弟..但我問,從創建curl命令的存儲庫(不MKDIR和chmod) – BasK 2015-01-29 04:38:24

+0

在我看來,有#4中的錯字('en_snap' - >'es_snap') – potar 2016-06-06 07:09:36

+0

別你認爲在備份文件夾中存在777個燙髮是否過於寬泛並存在安全問題? – Daniel 2016-07-14 08:17:46

0

您的查詢看起來不錯。但是,您是否具有在「/ mount/backups/my_backup」創建回購的適當權限。以sudo用戶身份試用curl命令。這值得一試!

原因,我認爲這是一個權限問題是因爲在錯誤日誌以下。 嵌套:BlobStoreException [無法在[/ mount/backups/my_backup]上創建目錄]; 」,‘狀態’:500}

+0

yes ..我知道權限異常...我也在我的查詢前添加了Sudo字詞..它不起作用.. – BasK 2014-12-17 05:27:25

1

得到了同樣的錯誤,我必須確保相同的路徑是所有節點上可寫的(相同的用戶),我直接安裝在一個節點的目錄,和。使用NFS掛載到其他的人要解決燙髮,編輯/ etc/passwd和更改登錄shell從/ sbin目錄/ nolgin爲/ bin/bash的elasticsearch,然後運行「蘇 - elasticsearch」。然後試着寫一個文件該目錄。你必須做,所有的節點上。

+0

Hi @sean。,您能簡單介紹一下您的解決方案。 – BasK 2015-01-28 08:45:13

+0

訣竅是每個節點都必須具有掛載和寫入功能。太好了! – 2017-06-30 19:44:41