日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Elasticsearch数据备份与恢复(基于HDFS)

發(fā)布時(shí)間:2024/4/17 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Elasticsearch数据备份与恢复(基于HDFS) 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Elasticsearch數(shù)據(jù)備份與恢復(fù)(基于HDFS)

1.(所有機(jī)子上)安裝es hdfs倉(cāng)庫(kù)插件repository-hdfs

# repository-hdfs一定要和es版本匹配 # 在線 bin/elasticsearch-plugin install repository-hdfs# 離線 bin/elasticsearch-plugin install file:///xxx/repository-hdfs-x.x.x.zip.zip

2. (所有機(jī)子上)設(shè)置ES-HDFS倉(cāng)庫(kù)安全策略

plugins/repository-hdfs/plugin-security.policy追加

permission java.lang.RuntimePermission "accessDeclaredMembers"; permission java.lang.RuntimePermission "getClassLoader"; permission java.lang.RuntimePermission "shutdownHooks"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; permission javax.security.auth.AuthPermission "doAs"; permission javax.security.auth.AuthPermission "getSubject"; permission javax.security.auth.AuthPermission "modifyPrivateCredentials"; permission java.security.AllPermission; permission java.util.PropertyPermission "*", "read,write"; permission javax.security.auth.PrivateCredentialPermission "org.apache.hadoop.security.Credentials * \"*\"", "read";

config/jvm.options追加

Djava.security.policy=file:xxx/plugins/repository-hdfs/plugin-security.policy

3.(所有機(jī)子上)設(shè)置JAVA安全管理器

$JAVA_HOME/jre/lib/security/java.policy追加

permission java.security.AllPermission;

重啟Es集群

4. (一臺(tái)機(jī)子上)創(chuàng)建HDFS倉(cāng)庫(kù)

# 創(chuàng)建遠(yuǎn)程倉(cāng)庫(kù),目錄為/user/xxx/es/repository/es_hdfs_repository # 在HDFS 50070查看 # uri需要是active的namenode節(jié)點(diǎn) curl -XPUT 'http://host:esPort/_snapshot/es_hdfs_repository' -d ' {"type":"hdfs","settings":{"uri":"hdfs://host:hdfsPort/","path":"es/repository/es_hdfs_repository"} }'

5. (一臺(tái)機(jī)子上)備份

# 對(duì)所有open的index進(jìn)行備份,創(chuàng)建一個(gè)snapshot_1的備份 # wait_for_completion會(huì)堵塞到備份完成 curl -XPUT 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1?wait_for_completion=true'# 指定索引備份 curl -XPUT 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1?wait_for_completion=true' -d ' {"indices":["index1","index2"],"ignore_unavailable":true,"include_global_state":false,"partial":true }'# 查看備份進(jìn)度和結(jié)果 curl -XGET 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1?pretty'

6.(一臺(tái)機(jī)子上)恢復(fù)

# 恢復(fù)指定索引 #include_global_state=true 集群狀態(tài)也備份 #ignore_unavailable 部分索引不存在時(shí)也通過(guò),否則認(rèn)為不成功 #partial=true 部分失效也可以通過(guò),否則認(rèn)為不成功 curl -XPOST 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1/_restore?wait_for_completion=true' -d ' {"indices":["redisindex"],"ignore_unavailable":true,"include_global_state":false,"partial":true }'# 恢復(fù)snapshot_1全部索引 curl -XPOST 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1/_restore?wait_for_completion=true'#恢復(fù)進(jìn)度和結(jié)果 curl -XGET 'http://host:esPort/index1/_recovery?pretty'

Tips:

恢復(fù)之前最好先把所有close,防止恢復(fù)期間還有新數(shù)據(jù)產(chǎn)生

如果是不存在的索引,不在考慮范圍

7.其他

# 關(guān)閉索引 curl -XPOST 'hhtp://host:esPort/eventindex/_close'# 打開(kāi)索引 curl -XPOST 'http://host:esPort/eventindex/_open'# 刪除備份 # 備份是增量備份的,所以不要輕易手動(dòng)刪,否則會(huì)出現(xiàn)索引損壞而無(wú)法恢復(fù) # 正確的姿勢(shì) curl -XDELETE 'http://host:esPort/_snapshot/es_hdfs_repository/snapshot_1'

轉(zhuǎn)載于:https://www.cnblogs.com/xixisix/p/11023019.html

與50位技術(shù)專(zhuān)家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖

總結(jié)

以上是生活随笔為你收集整理的Elasticsearch数据备份与恢复(基于HDFS)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。