<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Elasticsearch整理匯總-elasticdump備份和還原(三)

      聲明:所有內容均為本人查找網上資料匯總整理,非本人原創,但有本人整理心得;感謝每位學習愛好者對知識的傳承和分享!!!

       

      # 注意:
      1.在進行本地備份時使用--type需要備份索引和數據(mapping,data)
      2.在將數據備份到另外一臺ES節點時需要比本地備份多備份一種數據類型(analyzer,mapping,data,template)

       

      # 前提:
      · 必須要有Node環境和npm軟件:nodejs,npm  
      
      1.:下載包
      curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash -
      
      2.:安裝包(如果本身有node包但是不是新版本建議卸載重裝)
      yum install -y nodejs
      
      3.:驗證安裝是否成功
      node -v
      
      4.:設置淘寶鏡像
      npm config set registry http://registry.npm.taobao.org
      
      5.:安裝npm(只需要在一個節點安裝即可,如果前端還有nginx做反向代理可以每個節點都裝)
      [root@elkstack01 ~]# yum install -y npm
      
      6.:進入下載head插件代碼目錄
      [root@elkstack01 src]# cd /usr/local/
      
      7.:從GitHub上克隆代碼到本地(或者直接從找es-head的包)
      [root@elkstack01 local]# git clone git://github.com/mobz/elasticsearch-head.git
      
      8.:克隆完成后,進入elasticsearch插件目錄
      [root@elkstack01 local]# cd elasticsearch-head/
      
      9.:清除緩存
      [root@elkstack01 elasticsearch-head]# npm cache clean -f
      #使用npm安裝n模塊(不同的項目js腳本所需的node版本可能不同,所以就需要node版本管理工具)
      
      10.安裝elasticdump
      [root@db04 ~]# npm install elasticdump -g
      
      11.本地目錄備份
      
      ## 第一次進行的是索引的備份
      ## 第二次進行的是數據的備份
      [root@db04 bin]# ./elasticdump --input=http://10.0.0.54:9200/student/user --output=/tmp/student_mapping.json --type=mapping
      Wed, 12 Aug 2020 07:41:59 GMT | starting dump
      Wed, 12 Aug 2020 07:41:59 GMT | got 1 objects from source elasticsearch (offset: 0)
      Wed, 12 Aug 2020 07:41:59 GMT | sent 1 objects to destination file, wrote 1
      Wed, 12 Aug 2020 07:41:59 GMT | got 0 objects from source elasticsearch (offset: 1)
      Wed, 12 Aug 2020 07:41:59 GMT | Total Writes: 1
      Wed, 12 Aug 2020 07:41:59 GMT | dump complete
      [root@db04 bin]# ./elasticdump --input=http://10.0.0.54:9200/student/user --output=/tmp/student_data.json --type=data
      Wed, 12 Aug 2020 07:42:21 GMT | starting dump
      Wed, 12 Aug 2020 07:42:21 GMT | got 8 objects from source elasticsearch (offset: 0)
      Wed, 12 Aug 2020 07:42:21 GMT | sent 8 objects to destination file, wrote 8
      Wed, 12 Aug 2020 07:42:21 GMT | got 0 objects from source elasticsearch (offset: 8)
      Wed, 12 Aug 2020 07:42:21 GMT | Total Writes: 8
      Wed, 12 Aug 2020 07:42:21 GMT | dump complete
      
      
      ##備份之后用Elasticsearch Head插件模擬數據丟失,誤刪除student索引和數據并用elasticdump恢復
      
      
      [root@db04 bin]# ./elasticdump --output=http://10.0.0.54:9200/student --input=/tmp/student_mapping.json --type=mapping
      Wed, 12 Aug 2020 07:46:21 GMT | starting dump
      Wed, 12 Aug 2020 07:46:21 GMT | got 1 objects from source file (offset: 0)
      Wed, 12 Aug 2020 07:46:21 GMT | sent 1 objects to destination elasticsearch, wrote 1
      Wed, 12 Aug 2020 07:46:21 GMT | got 0 objects from source file (offset: 1)
      Wed, 12 Aug 2020 07:46:21 GMT | Total Writes: 1
      Wed, 12 Aug 2020 07:46:21 GMT | dump complete
      [root@db04 bin]# ./elasticdump --output=http://10.0.0.54:9200/student --input=/tmp/student_data.json --type=data
      Wed, 12 Aug 2020 07:46:40 GMT | starting dump
      Wed, 12 Aug 2020 07:46:40 GMT | got 8 objects from source file (offset: 0)
      Wed, 12 Aug 2020 07:46:40 GMT | sent 8 objects to destination elasticsearch, wrote 8
      Wed, 12 Aug 2020 07:46:40 GMT | got 0 objects from source file (offset: 8)
      Wed, 12 Aug 2020 07:46:40 GMT | Total Writes: 8
      Wed, 12 Aug 2020 07:46:40 GMT | dump complete

       二、備份到另一臺ES節點(如果是同一集群的節點索引不能重名)

      # 備份到另一臺ES節點(同一集群索引不能重名)
      [root@db04 bin]# ./elasticdump --input=http://10.0.0.54:9200/student --output=http://10.0.0.55:9200/students --type=analyzer
      Wed, 12 Aug 2020 08:14:00 GMT | starting dump
      Wed, 12 Aug 2020 08:14:00 GMT | got 1 objects from source elasticsearch (offset: 0)
      Wed, 12 Aug 2020 08:14:01 GMT | sent 1 objects to destination elasticsearch, wrote 1
      Wed, 12 Aug 2020 08:14:01 GMT | got 0 objects from source elasticsearch (offset: 1)
      Wed, 12 Aug 2020 08:14:01 GMT | Total Writes: 1
      Wed, 12 Aug 2020 08:14:01 GMT | dump complete
      [root@db04 bin]# ./elasticdump --input=http://10.0.0.54:9200/student --output=http://10.0.0.55:9200/students --type=mapping
      Wed, 12 Aug 2020 08:14:10 GMT | starting dump
      Wed, 12 Aug 2020 08:14:10 GMT | got 1 objects from source elasticsearch (offset: 0)
      Wed, 12 Aug 2020 08:14:10 GMT | sent 1 objects to destination elasticsearch, wrote 1
      Wed, 12 Aug 2020 08:14:10 GMT | got 0 objects from source elasticsearch (offset: 1)
      Wed, 12 Aug 2020 08:14:10 GMT | Total Writes: 1
      Wed, 12 Aug 2020 08:14:10 GMT | dump complete
      [root@db04 bin]# ./elasticdump --input=http://10.0.0.54:9200/student --output=http://10.0.0.55:9200/students --type=data
      Wed, 12 Aug 2020 08:14:15 GMT | starting dump
      Wed, 12 Aug 2020 08:14:15 GMT | got 8 objects from source elasticsearch (offset: 0)
      Wed, 12 Aug 2020 08:14:15 GMT | sent 8 objects to destination elasticsearch, wrote 8
      Wed, 12 Aug 2020 08:14:15 GMT | got 0 objects from source elasticsearch (offset: 8)
      Wed, 12 Aug 2020 08:14:15 GMT | Total Writes: 8
      Wed, 12 Aug 2020 08:14:15 GMT | dump complete
      [root@db04 bin]#elasticdump --input=http://10.0.0.54:9200/student --output=http://100.10.0.55:9200/students --type=template

      三.本地備份與恢復腳本

      # 1.本地備份腳本
      [root@db04 ~]# vim output_Es.sh
      #!/bin/bash
      read -p '要備份的機器是:'${1}
      #要導出的索引名
      index_name='
      student
      '
      for index in `echo $index_name`
      do
          echo "start input index ${index}"
          elasticdump --input=http://${1}:9200/${index} --output=/data/${index}_alias.json --type=alias &> /dev/null
          elasticdump --input=http://${1}:9200/${index} --output=/data/${index}_analyzer.json --type=analyzer &> /dev/null
          elasticdump --input=http://${1}:9200/${index} --output=/data/${index}_data.json --type=data &> /dev/null
          elasticdump --input=http://${1}:9200/${index} --output=/data/${index}_alias.json --type=alias &> /dev/null
          elasticdump --input=http://${1}:9200/${index} --output=/data/${index}_template.json --type=template &> /dev/null
      done
      
      # 2.恢復腳本
      [root@db04 ~]# vim input_Es.sh
      #!/bin/bash
      read -p '要導入的機器是:'${1}
      #要導入的索引名
      index_name='
      student
      '
      for index in `echo $index_name`
      do
          echo "start input index ${index}"
          elasticdump --input=/data/${index}_alias.json --output=http://${1}:9200/${index} --type=alias &> /dev/null
          elasticdump --input=/data/${index}_analyzer.json --output=http://${1}:9200/${index} --type=analyzer &> /dev/null
          elasticdump --input=/data/${index}_data.json --output=http://${1}:9200/${index} --type=data &> /dev/null
          elasticdump --input=/data/${index}_template.json --output=http://${1}:9200/${index} --type=template &> /dev/null
      done

      測試腳本

      # 0.配置環境變量
      [root@db04 ~]# vim /etc/profile.d/elasticdump.sh 
      export PATH=/root/node-v10.13.0-linux-x64/lib/node_modules/elasticdump/bin:$PATH
      [root@db04 ~]# source /etc/profile
      
      
      # 1.創建備份目錄
      [root@db04 ~]# mkdir /data
      
      # 2.執行備份腳本
      [root@db04 ~]# sh output_Es.sh 
      要備份的機器是:10.0.0.54
      start input index student
      
      # 3.查看備份目錄
      [root@db04 ~]# ll /data/
      total 16
      -rw-r--r-- 1 root root    5 Aug 12 16:59 student_alias.json
      -rw-r--r-- 1 root root  101 Aug 12 16:59 student_analyzer.json
      -rw-r--r-- 1 root root 1284 Aug 12 16:59 student_data.json
      -rw-r--r-- 1 root root    5 Aug 12 16:59 student_template.json

      # 執行恢復腳本
      [root@db04 ~]# sh input_Es.sh
      要導入的機器是:10.0.0.54 start input index student
      ## 數據恢復

       4、ES訪問密碼

      在--input參數和--output參數的的url中添加賬號密碼
      # 例如
      elasticdump \
        --input=http://input-username:input-passowrd@input.es.com:9200/my_index
        --output=http://output-username:output-password@output.es.com:9200/my_index
        --type=data

      elasticdump --input=http://elastic:root123@localhost:9200/buyertaxinfo --output=E:\test22\elasticdump\buyertaxinfo_data.json 

       

      posted @ 2021-01-12 16:20  jiajinhao  閱讀(548)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 国产精品午夜福利合集| 亚洲一区二区三区四区三级视频| 亚洲区一区二区三区亚洲| 免费a级毛片18以上观看精品| 若尔盖县| 蜜臀98精品国产免费观看| 久久久精品2019中文字幕之3| 最新国产AV最新国产在钱| ww污污污网站在线看com| 郁南县| 精品国产成人一区二区| 一区二区三区精品自拍视频| 国产目拍亚洲精品二区| 天天做天天爱夜夜爽毛片| 在线观看潮喷失禁大喷水无码| 亚洲天堂av在线免费看| 日本免费精品| 午夜DY888国产精品影院 | 真人无码作爱免费视频| 亚洲精品无amm毛片| 国产精品自在拍首页视频| 中文区中文字幕免费看| 免费极品av一视觉盛宴| 国产精品爽爽爽一区二区| 人成午夜免费大片| 亚洲欧美日韩综合久久久| 亚洲狠狠婷婷综合久久久| 久久天天躁夜夜躁狠狠| 无码人妻斩一区二区三区| 欧美综合区自拍亚洲综合绿色| 国产精品人成在线播放蜜臀| 亚洲国产精品成人一区二区在线| 成人拍拍拍无遮挡免费视频| 国产精品三级爽片免费看| 国模肉肉视频一区二区三区| 欧美巨大极度另类| 亚洲精品蜜桃久久久久久| a4yy私人毛片| 日韩精品一区二区亚洲专区| 中文字幕国产精品资源| av大片在线无码免费|