repository-hdfs安裝包的下載下傳位址: https://oss.sonatype.org/content/repositories/snapshots/org/elasticsearch/elasticsearch-repository-hdfs/
背景說明
由于業務需要将ES-2.2.1版本更新到ES-2.3.2版本,需要将index遷移過去,查了很多資料,最後決定用es的快照/恢複子產品來實作索引遷移。
在這裡我采用CDH5.6.0的HDFS作為快照的存儲檔案系統,在ES中安裝repository-hdfs這個插件
hdfs的路徑為:
hdfs://192.168.10.236:8020
線上安裝踩過的坑(失敗)
- 按照repository-hdfs插件位址的說明,可以用
線上安裝,然而安裝的時候一直報錯,經過檢查,是bin/plugin install elasticsearch/elasticsearch-repository-hdfs/2.3.2
裡面的版本設定問題,ES-2.3.2版本卻對應着2.3.1的安裝包,最後執行plugin-descriptor.properties
安裝成功bin/plugin install elasticsearch/elasticsearch-repository-hdfs/2.3.1
- 于是按照repository-hdfs插件位址的說明
repositories
hdfs:
uri: "hdfs://<host>:<port>/" # optional - Hadoop file-system URI
path: "some/path" # required - path with the file-system where data is stored/loaded
load_defaults: "true" # optional - whether to load the default Hadoop configuration (default) or not
conf_location: "extra-cfg.xml" # optional - Hadoop configuration XML to be loaded (use commas for multi values)
conf.<key> : "<value>" # optional - 'inlined' key=value added to the Hadoop configuration
concurrent_streams: # optional - the number of concurrent streams (defaults to )
compress: "false" # optional - whether to compress the metadata or not (default)
user: "foobar" # optional - user name for creating the file system. Typically used along-side the uri for `SIMPLE` authentication
## Kerberos specific settings
user_keytab: "other/path" # optional - user keytab
user_principal: "buckethead" # optional - user's Kerberos principal name
user_principal_hostname: "gw" # optional - hostname replacing the user's Kerberos principal $host
在elasticsearch.yml配置檔案後加上,
repositories.hdfs:
uri: "hdfs://192.168.10.236:8020"
path: "/es"
load_defaults: "true"
concurrent_streams:
conf_location: "core-site.xml,hdfs-site.xml"
compress: "true"
把CDH5.6.0中的HDFS裡的
/etc/hadoop/conf/hdfs-site.xml
和
core-site.xml
複制到ES每個節點的
/elasticsearch-2.3.2/conf/
下,并重新開機ES叢集
3.建立repository,執行
```
curl -XPUT '192.168.10.225:9201/_snapshot/backup?pretty' -d '{
"type": "hdfs",
"settings": {
"uri": "hdfs://192.168.10.236:8020",
"path": "/es",
"load_defaults": "true"
}
}'
```
結果報了
Server IPC version 9 cannot communicate with client version 4
的錯誤,原因是線上安裝的插件裡的jar包版本太舊,線上安裝宣告失敗。
離線安裝repository-hdfs插件(成功)
1. 在repository-hdfs插件倉庫中下載下傳對應版本的插件,我這裡下載下傳 elasticsearch-repository-hdfs-2.3.2.BUILD-20160516.063716-13-hadoop2.zip
elasticsearch-repository-hdfs-2.3.2.BUILD-20160516.063716-13-hadoop2.zip
2. 将zip通過scp發送到每個es節點
3. 安裝
3. 配置
在elasticsearch.yml配置檔案後加上(必須,否則會有權限問題)
# 禁用jsm,使快照能儲存于hdfs
security.manager.enabled: false
至于下面的配置,可以加上,也可以通過restful api配置
repositories.hdfs:
uri: "hdfs://192.168.10.236:8020"
path: "/es"
load_defaults: "true"
concurrent_streams:
conf_location: "core-site.xml,hdfs-site.xml"
compress: "true"
重新開機每個節點
4. 建立repository (采用kopf插件)
