Elasticsearch系列---生產(chǎn)數(shù)據(jù)備份恢復(fù)方案

前言

生產(chǎn)環(huán)境中運(yùn)行的組件,只要有數(shù)據(jù)存儲(chǔ),定時(shí)備份、災(zāi)難恢復(fù)是必修課,mysql數(shù)據(jù)庫(kù)的備份方案已經(jīng)非常成熟,Elasticsearch也同樣有成熟的數(shù)據(jù)備份、恢復(fù)方案,我們來(lái)了解一下。

概要

本篇介紹Elasticsearch生產(chǎn)集群數(shù)據(jù)的數(shù)據(jù)備份、恢復(fù)和升級(jí)的常規(guī)操作。

curl命令

curl是Linux操作的必備工具,Elasticsearch生產(chǎn)環(huán)境的搭建,不能保證都能使用kibana訪問(wèn)到,而Elasticsearch Restful API都可以使用curl工具來(lái)完成訪問(wèn)。

使用curl還有一個(gè)好處:有些操作需要一連串的請(qǐng)求才能完成,我們可以使用shell腳本將這些關(guān)聯(lián)的操作,封裝到腳本里,后續(xù)使用起來(lái)就非常方便。

如果有定時(shí)執(zhí)行的命令,也是使用shell將一系列操作封裝好,運(yùn)用Linux自帶的crontab進(jìn)行觸發(fā)。

后續(xù)的一些操作命令,將會(huì)用curl來(lái)完成,并且只需要將完整的curl請(qǐng)求拷貝到kibana的dev tools上,kibana能夠自動(dòng)轉(zhuǎn)化成我們之前常見(jiàn)的請(qǐng)求,非常方便。

在Linux下的請(qǐng)求命令:

[esuser@elasticsearch02 ~]$ curl -XGET 'http://elasticsearch02:9200/music/children/_search?pretty' -H 'Content-Type: application/json' -d '
{
  "query": {
    "match_all": {}
  }
}
'

完整的命令拷貝到dev tools里時(shí),自動(dòng)會(huì)變成:

GET /music/children/_search
{

  "query": {

    "match_all": {}

  }

}

這工具真是強(qiáng)大,不過(guò)反過(guò)來(lái)操作不行的,我已經(jīng)試過(guò)了。

curl命令,有Body體的,記得加上-H 'Content-Type: application/json',?pretty參數(shù)可以讓響應(yīng)結(jié)果格式化輸出。

數(shù)據(jù)備份

我們知道Elasticsearch的索引拆分成多個(gè)shard進(jìn)行存儲(chǔ)在磁盤(pán)里,shard雖然分了primary shard和replica shard,可以保證集群的數(shù)據(jù)不丟失,數(shù)據(jù)訪問(wèn)不間斷,但如果機(jī)房停電導(dǎo)致集群節(jié)點(diǎn)全部宕機(jī)這種重大事故時(shí),我們就需要提前定期地對(duì)數(shù)據(jù)進(jìn)行備份,以防萬(wàn)一。

既然是磁盤(pán)文件存儲(chǔ),那存儲(chǔ)介質(zhì)的選擇就有很多了:本地磁盤(pán),NAS,文件存儲(chǔ)服務(wù)器(如FastDFS、HDFS等),各種云存儲(chǔ)(Amazon S3, 阿里云OSS)等

同樣的,Elasticsearch也提供snapshot api命令來(lái)完成數(shù)據(jù)備份操作,可以把集群當(dāng)前的狀態(tài)和數(shù)據(jù)全部存儲(chǔ)到一個(gè)其他目錄上,本地路徑或網(wǎng)絡(luò)路徑均可,并且支持增量備份??梢愿鶕?jù)數(shù)據(jù)量來(lái)決定備份的執(zhí)行頻率,增量備份的速度還是很快的。

創(chuàng)建備份倉(cāng)庫(kù)

我們把倉(cāng)庫(kù)地址暫定為本地磁盤(pán)的/home/esuser/esbackup目錄,

首先,我們需要在elasticsearch.yml配置文件中加上

path.repo: /home/esuser/esbackup

并重啟Elasticsearch。

啟動(dòng)成功后,發(fā)送創(chuàng)建倉(cāng)庫(kù)的請(qǐng)求:

[esuser@elasticsearch02 ~]$ curl -XPUT 'http://elasticsearch02:9200/_snapshot/esbackup?pretty' -H 'Content-Type: application/json' -d '
{
    "type": "fs", 
    "settings": {
        "location": "/home/esuser/esbackup",
        "max_snapshot_bytes_per_sec" : "50mb", 
        "max_restore_bytes_per_sec" : "50mb"
    }
}
'
{"acknowledged":true}
[esuser@elasticsearch02 ~]$ 

參數(shù)解釋:

  • type: 倉(cāng)庫(kù)的類型名稱,請(qǐng)求里都是fs,表示file system。
  • location: 倉(cāng)庫(kù)的地址,要與elasticsearch.yml配置文件相同,否則會(huì)報(bào)錯(cuò)
  • max_snapshot_bytes_per_sec: 指定數(shù)據(jù)從Elasticsearch到倉(cāng)庫(kù)(數(shù)據(jù)備份)的寫(xiě)入速度上限,默認(rèn)是20mb/s
  • max_restore_bytes_per_sec: 指定數(shù)據(jù)從倉(cāng)庫(kù)到Elasticsearch(數(shù)據(jù)恢復(fù))的寫(xiě)入速度上限,默認(rèn)也是20mb/s

用于限流的兩個(gè)參數(shù),需要根據(jù)實(shí)際的網(wǎng)絡(luò)進(jìn)行設(shè)置,如果備份目錄在同一局域網(wǎng)內(nèi),可以設(shè)置得大一些,便于加快備份和恢復(fù)的速度。

也有查詢命令可以看倉(cāng)庫(kù)的信息:

[esuser@elasticsearch02 ~]$ curl -XGET 'http://elasticsearch02:9200/_snapshot/esbackup?pretty'

{"esbackup":{"type":"fs","settings":{"location":"/home/esuser/esbackup","max_restore_bytes_per_sec":"50mb","max_snapshot_bytes_per_sec":"50mb"}}}

[esuser@elasticsearch02 ~]$

使用hdfs創(chuàng)建倉(cāng)庫(kù)

大數(shù)據(jù)這塊跟hadoop生態(tài)整合還是非常推薦的方案,數(shù)據(jù)備份這塊可以用hadoop下的hdfs分布式文件存儲(chǔ)系統(tǒng),關(guān)于hadoop集群的搭建方法,需要自行完成,本篇末尾有補(bǔ)充說(shuō)明,可供參考。

對(duì)Elasticsearch來(lái)說(shuō),需要安裝repository-hdfs的插件,我們的Elasticsearch版本是6.3.1,對(duì)應(yīng)的插件則使用repository-hdfs-6.3.1.zip,hadoop則使用2.8.1版本的。

插件下載安裝命令:

./elasticsearch-plugin install https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-hdfs/repository-hdfs-6.3.1.zip

如果生產(chǎn)環(huán)境的服務(wù)器無(wú)法連接外網(wǎng),可以先在其他機(jī)器上下載好,上傳到生產(chǎn)服務(wù)器,解壓到本地,再執(zhí)行安裝:

./elasticsearch-plugin install file:///opt/elasticsearch/repository-hdfs-6.3.1

安裝完成后記得重啟Elasticsearch節(jié)點(diǎn)。

查看節(jié)點(diǎn)狀態(tài):

[esuser@elasticsearch02 ~]$ curl -XGET elasticsearch02:9200/_cat/nodes?v

ip             heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.17.137           38          95   2    0.03    0.03     0.05 mdi       *      node-1
創(chuàng)建hdfs倉(cāng)庫(kù)

先查看節(jié)點(diǎn)的shard信息

[esuser@elasticsearch02 ~]$ curl -XGET 'http://elasticsearch02:9200/_count?pretty' -H 'Content-Type: application/json' -d '
 {
     "query": {
         "match_all": {}
     }
}'


{
  "count" : 5392,
  "_shards" : {
    "total" : 108,
    "successful" : 108,
    "skipped" : 0,
    "failed" : 0
  }
}

創(chuàng)建一個(gè)hdfs的倉(cāng)庫(kù),名稱為hdfsbackup

[esuser@elasticsearch02 ~]$ curl -XPUT  'http://elasticsearch02:9200/_snapshot/hdfsbackup?pretty' -H 'Content-Type: application/json' -d '
 {
   "type": "hdfs",
   "settings": {
     "uri": "hdfs://elasticsearch02:9000/",
     "path": "/home/esuser/hdfsbackup",
   "conf.dfs.client.read.shortcircuit": "false",
   "max_snapshot_bytes_per_sec" : "50mb", 
     "max_restore_bytes_per_sec" : "50mb"
   }
 }'

{
  "acknowledged" : true
}
驗(yàn)證倉(cāng)庫(kù)

倉(cāng)庫(kù)創(chuàng)建好了之后,可以用verify命令驗(yàn)證一下:

[esuser@elasticsearch02 ~]$ curl -XPOST 'http://elasticsearch02:9200/_snapshot/hdfsbackup/_verify?pretty'
{
  "nodes" : {
    "A1s1uus7TpuDSiT4xFLOoQ" : {
      "name" : "node-1"
    }
  }
}
索引備份

倉(cāng)庫(kù)創(chuàng)建好并驗(yàn)證完成后,可以執(zhí)行snapshot api對(duì)索引進(jìn)行備份了,

如果不指定索引名稱,表示備份當(dāng)前所有open狀態(tài)的索引都備份,還有一個(gè)參數(shù)wait_for_completion,表示是否需要等待備份完成后才響應(yīng)結(jié)果,默認(rèn)是false,請(qǐng)求提交后會(huì)立即返回,然后備份操作在后臺(tái)異步執(zhí)行,如果設(shè)置為true,請(qǐng)求就變成同步方式,后臺(tái)備份完成后,才會(huì)有響應(yīng)。建議使用默認(rèn)值即可,有時(shí)備份的整個(gè)過(guò)程會(huì)持續(xù)1-2小時(shí)。

示例1:備份所有的索引,備份名稱為snapshot_20200122

[esuser@elasticsearch02 ~]$ curl -XPUT 'http://elasticsearch02:9200/_snapshot/hdfsbackup/snapshot_20200122?pretty'
{
  "accepted" : true
}

示例2:備份索引music的數(shù)據(jù),備份名稱為snapshot_20200122_02,并指定wait_for_completion為true

[esuser@elasticsearch02 ~]$ curl -XPUT 'http://elasticsearch02:9200/_snapshot/hdfsbackup/snapshot_20200122_02?wait_for_completion=true&pretty' -H 'Content-Type: application/json' -d '
{
  "indices": "music",
  "ignore_unavailable": true,
  "include_global_state": false,
  "partial": true
}'


{
  "snapshot" : {
    "snapshot" : "snapshot_20200122_02",
    "uuid" : "KRXnzc6XSWagCQO92EQx6A",
    "version_id" : 6030199,
    "version" : "6.3.1",
    "indices" : [
      "music"
    ],
    "include_global_state" : false,
    "state" : "SUCCESS",
    "start_time" : "2020-01-22T07:11:06.594Z",
    "start_time_in_millis" : 1579677066594,
    "end_time" : "2020-01-22T07:11:07.313Z",
    "end_time_in_millis" : 1579677067313,
    "duration_in_millis" : 719,
    "failures" : [ ],
    "shards" : {
      "total" : 5,
      "failed" : 0,
      "successful" : 5
    }
  }
}

這條命令中幾個(gè)參數(shù)介紹:

  • indices:索引名稱,允許寫(xiě)多個(gè),用","分隔,支持通配符。
  • ignore_unavailable:可選值true/false,如果為true,indices里不存在的index就可以忽略掉,備份操作正常執(zhí)行,默認(rèn)是false,如果某個(gè)index不存在,備份操作會(huì)提示失敗。
  • include_global_state:可選值true/false,含義是要不要備份集群的全局state數(shù)據(jù)。
  • partial:可選值true/false,是否支持備份部分shard的數(shù)據(jù)。默認(rèn)值為false,如果索引的部分primary shard不可用,partial為false時(shí)備份過(guò)程會(huì)提示失敗。

使用snapshot api對(duì)數(shù)據(jù)的備份是增量進(jìn)行的,執(zhí)行snapshotting的時(shí)候,Elasticsearch會(huì)分析已經(jīng)存在于倉(cāng)庫(kù)中的snapshot對(duì)應(yīng)的index file,在前一次snapshot基礎(chǔ)上,僅備份創(chuàng)建的或者發(fā)生過(guò)修改的index files。這就允許多個(gè)snapshot在倉(cāng)庫(kù)中可以用一種緊湊的模式來(lái)存儲(chǔ),非常節(jié)省存儲(chǔ)空間,并且snapshotting過(guò)程是不會(huì)阻塞所有的Elasticsearch讀寫(xiě)操作的。

同樣的,snapshot作為數(shù)據(jù)快照,在它之后寫(xiě)入index中的數(shù)據(jù),是不會(huì)反應(yīng)到這次snapshot中的,snapshot數(shù)據(jù)的內(nèi)容包含index的副本,也可以選擇是否保存全局的cluster元數(shù)據(jù),元數(shù)據(jù)里面包含了全局的cluster設(shè)置和template。

每次只能執(zhí)行一次snapshot操作,如果某個(gè)shard正在被snapshot備份,那么這個(gè)shard此時(shí)就不能被移動(dòng)到其他node上去,這會(huì)影響shard rebalance的操作。只有在snapshot結(jié)束之后,這個(gè)shard才能夠被移動(dòng)到其他的node上去。

查看snapshot備份列表
  1. 查看倉(cāng)庫(kù)內(nèi)所有的備份列表
curl -XGET 'http://elasticsearch02:9200/_snapshot/hdfsbackup/_all?pretty'
  1. 查看單個(gè)備份數(shù)據(jù)
[esuser@elasticsearch02 ~]$ curl -XGET 'http://elasticsearch02:9200/_snapshot/hdfsbackup/snapshot_20200122_02?pretty'
{
  "snapshots" : [
    {
      "snapshot" : "snapshot_20200122_02",
      "uuid" : "KRXnzc6XSWagCQO92EQx6A",
      "version_id" : 6030199,
      "version" : "6.3.1",
      "indices" : [
        "music"
      ],
      "include_global_state" : false,
      "state" : "SUCCESS",
      "start_time" : "2020-01-22T07:11:06.594Z",
      "start_time_in_millis" : 1579677066594,
      "end_time" : "2020-01-22T07:11:07.313Z",
      "end_time_in_millis" : 1579677067313,
      "duration_in_millis" : 719,
      "failures" : [ ],
      "shards" : {
        "total" : 5,
        "failed" : 0,
        "successful" : 5
      }
    }
  ]
}
刪除snapshot備份

如果需要?jiǎng)h除某個(gè)snapshot備份快照,一定要使用delete命令,造成別自個(gè)跑到服務(wù)器目錄下做rm操作,因?yàn)閟napshot是增量備份的,里面有各種依賴關(guān)系,極可能損壞backup數(shù)據(jù),記住不要上來(lái)就自己干文件,讓人家標(biāo)準(zhǔn)的命令來(lái)執(zhí)行,命令如下:

[esuser@elasticsearch02 ~]$ curl -XDELETE 'http://elasticsearch02:9200/_snapshot/hdfsbackup/snapshot_20200122?pretty'
{
  "acknowledged" : true
}
查看備份進(jìn)度

備份過(guò)程長(zhǎng)短視數(shù)據(jù)量而定,wait_for_completion設(shè)置為true雖然可以同步得到結(jié)果,但時(shí)間太長(zhǎng)的話也不現(xiàn)實(shí),我們是希望備份操作后臺(tái)自己搞,我們時(shí)不時(shí)的看看進(jìn)度就行,其實(shí)還是調(diào)用的snapshot的get操作命令,加上_status參數(shù)即可,備份過(guò)程中會(huì)顯示什么時(shí)間開(kāi)始的,有幾個(gè)shard在備份等等信息:

curl -XGET 'http://elasticsearch02:9200/_snapshot/hdfsbackup/snapshot_20200122_02/_status?pretty'

取消備份

正在備份的數(shù)據(jù)可以執(zhí)行取消,使用的是delete命令:

curl -XDELETE 'http://elasticsearch02:9200/_snapshot/hdfsbackup/snapshot_20200122?pretty'

這個(gè)命令有兩個(gè)作用:

  1. 如果備份正在進(jìn)行中,那么取消備份操作,并且刪除備份了一半的數(shù)據(jù)。
  2. 如果備份已經(jīng)完成,直接刪除備份數(shù)據(jù)。

數(shù)據(jù)恢復(fù)

生產(chǎn)環(huán)境的備份操作,是定期執(zhí)行的,執(zhí)行的頻率看實(shí)際的數(shù)據(jù)量,有1天執(zhí)行1次的,有4小時(shí)一次的,簡(jiǎn)單的操作是使用shell腳本封裝備份的命令,然后使用Linux的crontab定時(shí)執(zhí)行。

既然數(shù)據(jù)有備份,那如果數(shù)據(jù)出現(xiàn)異常,或者需要使用到備份數(shù)據(jù)時(shí),恢復(fù)操作就能派上用場(chǎng)了。

常規(guī)恢復(fù)

數(shù)據(jù)恢復(fù)使用restore命令,示例如下:

[esuser@elasticsearch02 ~]$ curl -XPOST 'http://elasticsearch02:9200/_snapshot/hdfsbackup/snapshot_20200122_02/_restore?pretty'
{
  "accepted" : true
}

注意一下被恢復(fù)的索引,必須全部是close狀態(tài)的,否則會(huì)報(bào)錯(cuò),關(guān)閉索引的命令:

[esuser@elasticsearch02 ~]$ curl -XPOST  'http://elasticsearch02:9200/music/_close?pretty'

恢復(fù)完成后,索引自動(dòng)還原成open狀態(tài)。

同樣有些參數(shù)可以進(jìn)行選擇:

[esuser@elasticsearch02 ~]$ curl -XPOST 'http://elasticsearch02:9200/_snapshot/hdfsbackup/snapshot_20200122_02/_restore
{
    "indices": "music", 
    "ignore_unavailable": true,
    "include_global_state": true
}

默認(rèn)會(huì)把備份數(shù)據(jù)里的索引全部還原,我們可以使用indices參數(shù)指定需要恢復(fù)的索引名稱。同樣可以使用wait_for_completion參數(shù),ignore_unavailable、partial和include_global_state與備份時(shí)效果相同,不贅述。

監(jiān)控restore的進(jìn)度

與備份類似,調(diào)用的recovery的get操作命令查看恢復(fù)的進(jìn)度:

curl -XGET 'http://elasticsearch02:9200/music/_recovery?pretty'

music為索引名稱。

取消restore

與備份類似,delete正在恢復(fù)的索引可以取消恢復(fù)過(guò)程:

curl -XDELETE 'http://elasticsearch02:9200/music'

集群升級(jí)

我們現(xiàn)在使用的版本是6.3.1,目前官網(wǎng)最新版本已經(jīng)是7.5.2了,如果沒(méi)有重大的變更或嚴(yán)重bug報(bào)告的情況下,一般是不需要做升級(jí),畢竟升級(jí)有風(fēng)險(xiǎn),發(fā)布要謹(jǐn)慎。

這里就簡(jiǎn)單說(shuō)一下通用的步驟,謹(jǐn)慎操作:

  1. 查看官網(wǎng)最新版本的文檔,從當(dāng)前版本到目標(biāo)版本的升級(jí),有哪些變化,新加入的功能和修復(fù)的bug。
  2. 在開(kāi)發(fā)環(huán)境或測(cè)試環(huán)境先執(zhí)行升級(jí),相應(yīng)的插件也做一次匹配升級(jí),穩(wěn)定運(yùn)行幾個(gè)項(xiàng)目版本周期后,再考慮生產(chǎn)環(huán)境的升級(jí)事宜。
  3. 升級(jí)前對(duì)數(shù)據(jù)進(jìn)行全量的備份,萬(wàn)一升級(jí)失敗,還有挽救的余地。
  4. 申請(qǐng)生產(chǎn)環(huán)境升級(jí)的時(shí)間窗口,逐個(gè)node進(jìn)行升級(jí)驗(yàn)證。

補(bǔ)充hadoop集群搭建

Elasticsearch的數(shù)據(jù)備份,通常建議的實(shí)踐方案是結(jié)合hadoop的hdfs文件存儲(chǔ),這里我們搭建一個(gè)hadoop的集群環(huán)境用作演示,hadoop相關(guān)的基礎(chǔ)知識(shí)請(qǐng)自行了解,已經(jīng)掌握的童鞋可以跳過(guò)。

版本環(huán)境:
hadoop 2.8.1

虛擬機(jī)環(huán)境

hadoop集群至少需要3個(gè)節(jié)點(diǎn)。我們選用elasticsearch02、elasticsearch03、elasticsearch04三臺(tái)機(jī)器用于搭建。

  1. 下載解壓

官網(wǎng)下載hadoop-2.8.1.tar.gz,解壓至/opt/hadoop目錄

  1. 設(shè)置環(huán)境變量

演示環(huán)境擁有root權(quán)限,就介紹一種最簡(jiǎn)單的設(shè)置方法,修改/etc/profile文件,添加變量后記得source一下該文件。


[root@elasticsearch02 ~]# vi /etc/profile

# 文件末尾添加
export HADOOP_HOME=/opt/hadoop/hadoop-2.8.1
export PATH=${HADOOP_HOME}/bin:$PATH

[root@elasticsearch02 ~]# source /etc/profile
  1. 創(chuàng)建hadoop數(shù)據(jù)目錄,啟動(dòng)hadoop時(shí)我們使用esuser賬戶,就在/home/esuser下創(chuàng)建目錄,如 /home/esuser/hadoopdata

  2. 修改hadoop的配置文件,在/opt/hadoop/hadoop-2.8.1/etc/hadoop目錄下,基本上是添加配置,涉及的配置文件:

  • core-site.xml
  • hdfs-site.xml
  • yarn-site.xml
  • mapred-site.xml
  • slaves(注:我們選定elasticsearch02為master,其余兩個(gè)為slave)

示例修改如下:

core-site.xml

<property>
  <name>fs.defaultFS</name>
  <value>hdfs://elasticsearch02:9000</value>
</property>

hdfs-site.xml

<property>
  <name>dfs.namenode.name.dir</name>
  <value>/home/esuser/hadoopdata/namenode</value>
</property>
<property>
  <name>dfs.datanode.data.dir</name>
  <value>/home/esuser/hadoopdata/datanode</value>
</property>

yarn-site.xml

<property>
  <name>yarn.resourcemanager.hostname</name>
  <value>elasticsearch02</value>
</property>

mapred-site.xml

<property>
  <name>mapreduce.framework.name</name>
  <value>yarn</value>
</property>

slaves

elasticsearch03
elasticsearch04
  1. 拷貝設(shè)置后的文件到另外兩臺(tái)機(jī)器上
scp -r /opt/hadoop/hadoop-2.8.1 esuser@elasticsearch03:/opt/hadoop/hadoop-2.8.1
scp -r /opt/hadoop/hadoop-2.8.1 esuser@elasticsearch04:/opt/hadoop/hadoop-2.8.1

拷貝的文件有點(diǎn)大,需要等一會(huì)兒,拷貝完成后,在elasticsearch03、elasticsearch04再設(shè)置一次HADOOP_HOME環(huán)境變量

  1. 啟動(dòng)集群

格式化namenode,在hadoop master節(jié)點(diǎn)(elasticsearch02),HADOOP_HOME/sbin目錄下執(zhí)行hdfs namenode -format

執(zhí)行啟動(dòng)命令:start-dfs.sh
這個(gè)啟動(dòng)過(guò)程會(huì)建立到elasticsearch03、elasticsearch04的ssh連接,輸入esuser的密碼即可,也可以提前建立好免密ssh連接。

我們只需要用它的hdfs服務(wù),其他的組件可以不啟動(dòng)。

驗(yàn)證啟動(dòng)是否成功,三臺(tái)機(jī)器分別輸入jps,看下面的進(jìn)程,如無(wú)意外理論上應(yīng)該是這樣:
elasticsearch02:NameNode、SecondaryNameNode
elasticsearch03:DataNode
elasticsearch04:DataNode

同時(shí)在瀏覽器上輸入hadoop master的控制臺(tái)地址:http://192.168.17.137:50070/dfshealth.html#tab-overview,應(yīng)該能看到這兩個(gè)界面:

image

image

datanodes看到2個(gè)結(jié)點(diǎn),表示集群?jiǎn)?dòng)成功,如果只能看到一個(gè)或一個(gè)都沒(méi)有,可以查看相應(yīng)的日志:/opt/hadoop/hadoop-2.8.1/logs

Error: JAVA_HOME is not set and could not be found 錯(cuò)誤解決辦法

這個(gè)明明已經(jīng)設(shè)置了JAVA_HOME,并且export命令也能看到,啟動(dòng)時(shí)死活就是不行,不跟他杠了,直接在/opt/hadoop/hadoop-2.8.1/etc/hadoop/hadoop-env.sh文件加上

export JAVA_HOME="/opt/jdk1.8.0_211"

小結(jié)

本篇主要以hadoop分布式文件存儲(chǔ)為背景,講解了Elasticsearch數(shù)據(jù)的備份與恢復(fù),可以了解一下。集群版本升級(jí)這類操作,實(shí)踐起來(lái)比較復(fù)雜,受項(xiàng)目本身影響比較大,這里就簡(jiǎn)單提及要注意的地方,沒(méi)有作詳細(xì)的案例操作,真要有版本升級(jí)的操作,請(qǐng)各位慎重操作,多驗(yàn)證,確保測(cè)試環(huán)境充分測(cè)試后再上生產(chǎn),記得數(shù)據(jù)要備份。

專注Java高并發(fā)、分布式架構(gòu),更多技術(shù)干貨分享與心得,請(qǐng)關(guān)注公眾號(hào):Java架構(gòu)社區(qū)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容