CentOS 7 下 elasticsearch-dump 迁移 elasticsearch 数据

屠锐
2023-12-01

NodeJS 安装

安装包下载
[root@testbmj ~]# wget https://nodejs.org/dist/v14.15.1/node-v14.15.1-linux-x64.tar.xz
解压 && 配置软连接
# 解压
[root@testbmj ~]# tar -xf node-v14.15.1-linux-x64.tar.xz

# 分发
[root@testbmj ~]# mv node-v14.15.1-linux-x64 /usr/local/nodejs

# 配置软连接
[root@testbmj ~]# ln -s /usr/local/nodejs/bin/npm /usr/local/bin/
[root@testbmj ~]# ln -s /usr/local/nodejs/bin/node /usr/local/bin/

elasticsearch-dump 安装

[root@testbmj ~]# npm install elasticdump -g

elasticdump 迁移索引

迁移 settings
[root@testbmj ~]# /usr/local/nodejs/bin/elasticdump --input=http://192.168.8.67:9200/local20201230 --output=http://192.168.8.241:9230/local20201230 --type=settings
Thu, 03 Jun 2021 08:35:17 GMT | starting dump
Thu, 03 Jun 2021 08:35:17 GMT | got 1 objects from source elasticsearch (offset: 0)
Thu, 03 Jun 2021 08:35:35 GMT | sent 1 objects to destination elasticsearch, wrote 1
Thu, 03 Jun 2021 08:35:35 GMT | got 0 objects from source elasticsearch (offset: 1)
Thu, 03 Jun 2021 08:35:35 GMT | Total Writes: 1
Thu, 03 Jun 2021 08:35:35 GMT | dump complete
迁移 mapping
[root@testbmj ~]# /usr/local/nodejs/bin/elasticdump --input=http://192.168.8.67:9200/local20201230 --output=http://192.168.8.241:9230/local20201230 --type=mapping
Thu, 03 Jun 2021 08:35:55 GMT | starting dump
Thu, 03 Jun 2021 08:35:56 GMT | got 1 objects from source elasticsearch (offset: 0)
Thu, 03 Jun 2021 08:37:40 GMT | sent 1 objects to destination elasticsearch, wrote 1
Thu, 03 Jun 2021 08:37:40 GMT | got 0 objects from source elasticsearch (offset: 1)
Thu, 03 Jun 2021 08:37:40 GMT | Total Writes: 1
Thu, 03 Jun 2021 08:37:40 GMT | dump complete
迁移 data
[root@testbmj ~]# /usr/local/nodejs/bin/elasticdump --input=http://192.168.8.67:9200/local20201230 --output=http://jhmk:jhmk1234@192.168.8.241:9230/local20201230 --type=data
Thu, 03 Jun 2021 08:38:11 GMT | starting dump
Thu, 03 Jun 2021 08:38:16 GMT | got 100 objects from source elasticsearch (offset: 0)
Thu, 03 Jun 2021 08:44:27 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:44:30 GMT | got 100 objects from source elasticsearch (offset: 100)
Thu, 03 Jun 2021 08:47:58 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:48:00 GMT | got 100 objects from source elasticsearch (offset: 200)
Thu, 03 Jun 2021 08:49:56 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:49:57 GMT | got 100 objects from source elasticsearch (offset: 300)
Thu, 03 Jun 2021 08:50:47 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:50:51 GMT | got 100 objects from source elasticsearch (offset: 400)
Thu, 03 Jun 2021 08:52:09 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:52:11 GMT | got 100 objects from source elasticsearch (offset: 500)
Thu, 03 Jun 2021 08:53:22 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:53:24 GMT | got 100 objects from source elasticsearch (offset: 600)
Thu, 03 Jun 2021 08:54:35 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:54:36 GMT | got 100 objects from source elasticsearch (offset: 700)
Thu, 03 Jun 2021 08:54:52 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:54:54 GMT | got 100 objects from source elasticsearch (offset: 800)
Thu, 03 Jun 2021 08:55:54 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:55:57 GMT | got 100 objects from source elasticsearch (offset: 900)
Thu, 03 Jun 2021 08:56:12 GMT | sent 100 objects to destination elasticsearch, wrote 100
Thu, 03 Jun 2021 08:56:14 GMT | got 100 objects from source elasticsearch (offset: 1000)

参考

 类似资料: