Get the App
SLTechnology News&Howtos  ›  Servers  › 

Elasticdump migrates elasticsearch data

Shulou Source: shulou.com Published: 2022-06-03 05:51:39 10月27日 Update

Elasticdump migrates elasticsearch data

Elasticdump github address

Https://github.com/taskrabbit/elasticsearch-dump

After tossing about for a while, nodejs lost all patience and decisively used the docker method.

1. Download docker image

Pull the image

Docker pull taskrabbit/elasticsearch-dump2, export data

If you export the data as a file, you need to mount the host directory to the container.

# create a data directory in advance. Mkdir / data

Export the data to the json file, mount the host / data directory to the container / tmp directory, and export the specified file-- output to the / tmp directory.

Docker run-- net=host-- rm-ti-v / data:/tmp taskrabbit/elasticsearch-dump\-- input= http://localhost:9200/info-ad\-- output=/tmp/info-ad-map.json\-- type=data# export log Wed, 11 Dec 2019 09:45:35 GMT | starting dumpWed, 11 Dec 2019 09:45:35 GMT | got 16 objects from source elasticsearch (offset: 0) Wed, 11 Dec 2019 09:45:35 GMT | sent 16 objects to destination file, wrote 16Wed 11 Dec 2019 09:45:35 GMT | got 0 objects from source elasticsearch (offset: 16) Wed, 11 Dec 2019 09:45:35 GMT | Total Writes: 16Wed, 11 Dec 2019 09:45:35 GMT | dump complete# export file [root@localhost / data] # lltotal 20 RW Murray 1 root root 18192 Dec 11 17:45 info-ad-map.json3, import data docker run-- net=host-- rm-ti-v / data:/tmp taskrabbit/elasticsearch-dump\-- input=/tmp/info-ad-map.json\-- output= http://localhost:9200/abcd# Import log Wed, 11 Dec 2019 09:47:43 GMT | starting dumpWed, 11 Dec 2019 09:47:43 GMT | got 16 objects from source file (offset: 0) Wed 11 Dec 2019 09:47:44 GMT | sent 16 objects to destination elasticsearch, wrote 16Wed, 11 Dec 2019 09:47:44 GMT | got 0 objects from source file (offset: 16) Wed, 11 Dec 2019 09:47:44 GMT | Total Writes: 16Wed, 11 Dec 2019 09:47:44 GMT | dump complete

Ps: you need to use-- net=host to mount the network to the container when using localhost:9200

Tags: Data directory file container host host log mirror decisiveness patience address form mode network Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Xiaomi Shulou Information MariaDB Linux