how to move elasticsearch data from one server to another

后端 未结 12 1449
悲哀的现实
悲哀的现实 2020-12-12 12:27

How do I move Elasticsearch data from one server to another?

I have server A running Elasticsearch 1.1.1 on one local node with mul

相关标签:
12条回答
  • 2020-12-12 13:16

    You can use snapshot/restore feature available in Elasticsearch for this. Once you have setup a Filesystem based snapshot store, you can move it around between clusters and restore on a different cluster

    0 讨论(0)
  • 2020-12-12 13:17

    If you simply need to transfer data from one elasticsearch server to another, you could also use elasticsearch-document-transfer.

    Steps:

    1. Open a directory in your terminal and run
      $ npm install elasticsearch-document-transfer.
    2. Create a file config.js
    3. Add the connection details of both elasticsearch servers in config.js
    4. Set appropriate values in options.js
    5. Run in the terminal
      $ node index.js
    0 讨论(0)
  • 2020-12-12 13:19

    I've always had success simply copying the index directory/folder over to the new server and restarting it. You'll find the index id by doing GET /_cat/indices and the folder matching this id is in data\nodes\0\indices (usually inside your elasticsearch folder unless you moved it).

    0 讨论(0)
  • 2020-12-12 13:23

    Use ElasticDump

    1) yum install epel-release

    2) yum install nodejs

    3) yum install npm

    4) npm install elasticdump

    5) cd node_modules/elasticdump/bin

    6)

    ./elasticdump \
    
      --input=http://192.168.1.1:9200/original \
    
      --output=http://192.168.1.2:9200/newCopy \
    
      --type=data
    
    0 讨论(0)
  • 2020-12-12 13:23

    If anyone encounter the same issue, when trying to dump from elasticsearch <2.0 to >2.0 you need to do:

    elasticdump --input=http://localhost:9200/$SRC_IND --output=http://$TARGET_IP:9200/$TGT_IND --type=analyzer
    elasticdump --input=http://localhost:9200/$SRC_IND --output=http://$TARGET_IP:9200/$TGT_IND --type=mapping
    elasticdump --input=http://localhost:9200/$SRC_IND --output=http://$TARGET_IP:9200/$TGT_IND --type=data --transform "delete doc.__source['_id']"
    
    0 讨论(0)
  • 2020-12-12 13:24

    I tried on ubuntu to move data from ELK 2.4.3 to ELK 5.1.1

    Following are the steps

    $ sudo apt-get update
    
    $ sudo apt-get install -y python-software-properties python g++ make
    
    $ sudo add-apt-repository ppa:chris-lea/node.js
    
    $ sudo apt-get update
    
    $ sudo apt-get install npm
    
    $ sudo apt-get install nodejs
    
    $ npm install colors
    
    $ npm install nomnom
    
    $ npm install elasticdump
    

    in home directory goto

    $ cd node_modules/elasticdump/
    

    execute the command

    If you need basic http auth, you can use it like this:

    --input=http://name:password@localhost:9200/my_index
    

    Copy an index from production:

    $ ./bin/elasticdump --input="http://Source:9200/Sourceindex" --output="http://username:password@Destination:9200/Destination_index"  --type=data
    
    0 讨论(0)
提交回复
热议问题