elasticsearch匯入匯出工具elasticdump安裝和使用小記
首選需要安裝npm工具,具體可參考:
開始安裝elasticdump:
# npm install elasticdump -g
/usr/bin/elasticdump -> /usr/lib/node_modules/elasticdump/bin/elasticdump
/usr/bin/multielasticdump -> /usr/lib/node_modules/elasticdump/bin/multielasticdump
/usr/lib
└─┬ elasticdump@3.3.19
├── async@2.6.1
├─┬ aws-sdk@2.303.0
│ ├─┬ buffer@4.9.1
│ │ ├── base64-js@1.3.0
│ │ └── isarray@1.0.0
│ ├── events@1.1.1
│ ├── ieee754@1.1.8
│ ├── jmespath@0.15.0
│ ├── querystring@0.2.0
│ ├── sax@1.2.1
│ ├─┬ url@0.10.3
│ │ └── punycode@1.3.2
│ ├── uuid@3.1.0
│ └─┬ xml2js@0.4.19
│ └── xmlbuilder@9.0.7
├── aws4@1.8.0
├── decimal.js@10.0.1
├── ini@1.3.5
├─┬ JSONStream@1.3.4
│ ├── jsonparse@1.3.1
│ └── through@2.3.8
├── lodash@4.17.10
├── lossless-json@1.0.3
├─┬ optimist@0.6.1
│ ├── minimist@0.0.10
│ └── wordwrap@0.0.3
└─┬ request@2.88.0
├── aws-sign2@0.7.0
├── caseless@0.12.0
├─┬ combined-stream@1.0.6
│ └── delayed-stream@1.0.0
├── extend@3.0.2
├── forever-agent@0.6.1
├─┬ form-data@2.3.2
│ └── asynckit@0.4.0
├─┬ har-validator@5.1.0
│ ├─┬ ajv@5.5.2
│ │ ├── co@4.6.0
│ │ ├── fast-deep-equal@1.1.0
│ │ ├── fast-json-stable-stringify@2.0.0
│ │ └── json-schema-traverse@0.3.1
│ └── har-schema@2.0.0
├─┬ http-signature@1.2.0
│ ├── assert-plus@1.0.0
│ ├─┬ jsprim@1.4.1
│ │ ├── extsprintf@1.3.0
│ │ ├── json-schema@0.2.3
│ │ └─┬ verror@1.10.0
│ │ └── core-util-is@1.0.2
│ └─┬ sshpk@1.14.2
│ ├── asn1@0.2.4
│ ├── bcrypt-pbkdf@1.0.2
│ ├── dashdash@1.14.1
│ ├── ecc-jsbn@0.1.2
│ ├── getpass@0.1.7
│ ├── jsbn@0.1.1
│ ├── safer-buffer@2.1.2
│ └── tweetnacl@0.14.5
├── is-typedarray@1.0.0
├── isstream@0.1.2
├── json-stringify-safe@5.0.1
├─┬ mime-types@2.1.20
│ └── mime-db@1.36.0
├── oauth-sign@0.9.0
├── performance-now@2.1.0
├── qs@6.5.2
├── safe-buffer@5.1.2
├─┬ tough-cookie@2.4.3
│ ├── psl@1.1.29
│ └── punycode@1.4.1
├── tunnel-agent@0.6.0
└── uuid@3.3.2
匯出es資料方法例子:
# elasticdump --input=http://192.168.0.1:9200/test --output=/data/elas_backup/test.json --type=data
Tue, 28 Aug 2018 09:15:54 GMT | starting dump
Tue, 28 Aug 2018 09:15:55 GMT | got 100 objects from source elasticsearch (offset: 0)
Tue, 28 Aug 2018 09:15:55 GMT | sent 100 objects to destination file, wrote 100
Tue, 28 Aug 2018 09:15:55 GMT | got 100 objects from source elasticsearch (offset: 100)
Tue, 28 Aug 2018 09:15:55 GMT | sent 100 objects to destination file, wrote 100
Tue, 28 Aug 2018 09:15:55 GMT | got 100 objects from source elasticsearch (offset: 200)
Tue, 28 Aug 2018 09:15:55 GMT | sent 100 objects to destination file, wrote 100
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
匯入es資料方法例子:
# elasticdump --input=/data/elas_backup/test.json --output=http://192.168.0.1:9200 --type=data
Tue, 28 Aug 2018 09:15:54 GMT | starting dump
Tue, 28 Aug 2018 09:15:55 GMT | got 100 objects from source elasticsearch (offset: 0)
Tue, 28 Aug 2018 09:15:55 GMT | sent 100 objects to destination file, wrote 100
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
從一個索引的資料遷移到另外一個索引的資料:
# elasticdump --ignore-errors=true --scrollTime=120m --bulk=true --input=http://192.168.0.1:9200/test --output=http://192.168.0.1:9200/chenfeng --type=data
備註:
--ignore-errors=true --scrollTime=120m --bulk=true 是批次匯入引數
匯出表結構mapping:
# elasticdump --input=http://192.168.0.1:9200/test --output=test-mapping.json --type=mapping
Wed, 29 Aug 2018 09:01:41 GMT | starting dump
Wed, 29 Aug 2018 09:01:42 GMT | got 1 objects from source elasticsearch (offset: 0)
Wed, 29 Aug 2018 09:01:42 GMT | sent 1 objects to destination file, wrote 1
Wed, 29 Aug 2018 09:01:42 GMT | got 0 objects from source elasticsearch (offset: 1)
Wed, 29 Aug 2018 09:01:42 GMT | Total Writes: 1
Wed, 29 Aug 2018 09:01:42 GMT | dump complete
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2213044/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【EXP/IMP】使用EXP /IMP工具“模糊”匯出和匯入
- 【EXPDP/IMPDP】使用 EXPDP/IMPDP工具“模糊”匯出和匯入
- exp/imp匯出匯入工具的使用
- oracle 匯出/匯入小結 以防忘記Oracle
- Oracle exp/imp匯出匯入工具的使用Oracle
- 如何使用 JavaScript 匯入和匯出 ExcelJavaScriptExcel
- 【匯入匯出】Oracle 常用匯入匯出工具集錦Oracle
- 使用工具類 使用poi匯入匯出excel報表Excel
- mongodb使用自帶命令工具匯出匯入資料MongoDB
- 【匯出匯入】匯出匯入 大物件物件
- python 小指令碼 (實現 elasticsearch 匯出匯入)Python指令碼Elasticsearch
- 如何使用JavaScript匯入和匯出Excel檔案JavaScriptExcel
- 比 poi匯入匯出更好用的 EasyExcel使用小結Excel
- java 匯入匯出Excel工具類ExcelUtilJavaExcel
- Oracle資料庫匯入匯出。imp匯入命令和exp匯出命令Oracle資料庫
- MySQL資料匯入匯出牛刀小試MySql
- kxcel, 方便匯入和匯出 ExcelExcel
- 匯出和匯入Gradle工程Gradle
- postgresql 資料匯入和匯出SQL
- 使用Dbeaver 進行資料的匯入和匯出
- 【匯入匯出】sqlldr 匯入案例SQL
- MySQL入門--匯出和匯入資料MySql
- Atlas2.2.0編譯、安裝及使用(整合ElasticSearch,匯入Hive資料)編譯ElasticsearchHive
- 【匯出匯入】% 在匯入匯出中的應用。
- NPOI匯出和匯入Excel,Word和PDFExcel
- DB2 匯入和匯出 命令列和客戶端匯出DB2命令列客戶端
- 【匯入匯出】將資料匯入到其他使用者
- Oracle全庫匯出和特定使用者匯入Oracle
- ES模組化的匯入和匯出
- 匯入和匯出AWR的資料
- 【mysql】資料庫匯出和匯入MySql資料庫
- BCP 資料的匯入和匯出
- ASP.NET Excel匯入和匯出ASP.NETExcel
- NDS的資料匯入和匯出
- Activity 流程模型匯入匯出-activity流程模型匯入匯出模型
- 安裝mongodb,建立資料庫、使用者、建立表、匯出匯入資料庫MongoDB資料庫
- Mysql匯入&匯出MySql
- Mysql匯入匯出MySql