Article directory
1. Pre-installation preparation
1. Install the Node.js tool first.
Node.js official website download address: Download address
Double-click the downloaded installation package, and click Next to complete the installation operation.
2. Then install elasticdump:
open the cmd command line, enter the following command, and press Enter to install:
npm install elasticdump -g
Check whether the installation is successful, and the version information can pop up to indicate that the installation is successful:
elasticdump --version
Two, ElasticSearch document data import and export
1. ElasticSearch document data export :
①Export commands that require username and password authentication:
elasticdump --input=http://username:[email protected]:9200/session_archive --output=D:\query.json --type=data
②Export commands that do not require username and password verification:
elasticdump --input=http://218.68.54.169:9200/session_archive --output=D:\query.json --type=data
The exported file is the query.json file placed on the D drive
2. ElasticSearch document data import :
① Import commands that require username and password authentication:
elasticdump --input=D:\query.json --output=http://username:[email protected]:9200/session_archive --type=data
②Import commands that do not require username and password authentication:
elasticdump --input=D:\query.json --output=http://10.81.240.76:9200/session_archive --type=data
3. Two ElasticSearch mutual import operations
elasticdump --input=http://username:[email protected]:9200/knowledgebase --output=http://username:[email protected]:9200/knowledgebase --type=data
PS: If ES does not require username and password authentication, username:password@ can be omitted
4. Is there a problem with different versions of ElasticSearch?
I tested the mutual import and export of data between ElasticSearch6.x and ElasticSearch7.x, and no problems were encountered, and the two can be imported and exported normally.