使用elasticdump遷移資料到新es叢集 薦
摘要:
參考文件
https://blog.csdn.net/u012731379/article/details/79856113
https://blog.csdn.net/u010466329/article/details/79209236
https://blog.csdn.n...
參考文件
https://blog.csdn.net/u012731379/article/details/79856113 https://blog.csdn.net/u010466329/article/details/79209236 https://blog.csdn.net/laoyang360/article/details/65449407
遷移方法
- 通過logstash的input和output配置遷移(配置靈活適用於長期資料同步等)
- 通過遷移工具如elasticdump等(適用於備份一次性小量資料操作)
- 通過elasticsarch自帶快照功能(適用於一次性遷移大量資料)
操作步驟
1、安裝elasticdump
[root@VM_8_24_centos ~]# yum install nodejs npm [root@VM_8_24_centos ~]# npm install elasticdump /root └─┬ [email protected] ├── [email protected] ├─┬ [email protected] │ ├─┬ [email protected] │ │ ├── [email protected] │ │ └── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ └── [email protected] │ ├── [email protected] │ └─┬ [email protected] │└── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├─┬ [email protected] │ ├── [email protected] │ └── [email protected] ├── [email protected] ├── [email protected] ├─┬ [email protected] │ ├── [email protected] │ └── [email protected] ├─┬ [email protected] │ ├── [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ └── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ └── [email protected] │ ├─┬ [email protected] │ │ ├─┬ [email protected] │ │ │ ├── [email protected] │ │ │ ├── [email protected] │ │ │ ├── [email protected] │ │ │ └─┬ [email protected] │ │ │└── [email protected] │ │ └── [email protected] │ ├─┬ [email protected] │ │ ├── [email protected] │ │ ├─┬ [email protected] │ │ │ ├── [email protected] │ │ │ ├── [email protected] │ │ │ └── [email protected] │ │ └─┬ [email protected] │ │├── [email protected] │ │├── [email protected] │ │├── [email protected] │ │├── [email protected] │ │├── [email protected] │ │├── [email protected] │ │├── [email protected] │ │└── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ └── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ ├── [email protected] │ │ └── [email protected] │ └── [email protected] ├─┬ [email protected] │ └── [email protected] └─┬ [email protected] ├── [email protected] └─┬ [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] └── [email protected] npm WARN enoent ENOENT: no such file or directory, open '/root/package.json' npm WARN root No description npm WARN root No repository field. npm WARN root No README data npm WARN root No license field. [root@VM_8_24_centos ~]# cd node_modules/elasticdump/bin
2、匯出mapping
[root@VM_8_24_centos bin]# ./elasticdump --input=http://10.2.3.159:9200/reconciliation--output=http://10.2.100.24:9200/reconciliationonline --type=mapping Mon, 11 Feb 2019 09:28:10 GMT | starting dump Mon, 11 Feb 2019 09:28:10 GMT | got 1 objects from source elasticsearch (offset: 0) Mon, 11 Feb 2019 09:28:16 GMT | sent 1 objects to destination elasticsearch, wrote 1 Mon, 11 Feb 2019 09:28:16 GMT | got 0 objects from source elasticsearch (offset: 1) Mon, 11 Feb 2019 09:28:16 GMT | Total Writes: 1 Mon, 11 Feb 2019 09:28:16 GMT | dump complete [root@VM_8_24_centos bin]# curl10.2.100.24:9200/_cat/indices|grep reconciliation % Total% Received % XferdAverage SpeedTimeTimeTimeCurrent DloadUploadTotalSpentLeftSpeed 43 3257843 1403700569400:00:050:00:020:00:035694yellow open reconciliationonlineKnZrsU-7TmWWBs-1-dBRrw 5 1001.1kb1.1kb
3、匯出data
[root@VM_8_24_centos bin]# ./elasticdump --input=http://10.2.3.159:9200/reconciliation--output=http://10.2.100.24:9200/reconciliationonline --type=data Mon, 11 Feb 2019 09:28:58 GMT | starting dump Mon, 11 Feb 2019 09:28:58 GMT | got 100 objects from source elasticsearch (offset: 0) Mon, 11 Feb 2019 09:29:19 GMT | sent 100 objects to destination elasticsearch, wrote 100 Mon, 11 Feb 2019 09:29:19 GMT | got 100 objects from source elasticsearch (offset: 100) Mon, 11 Feb 2019 09:29:51 GMT | sent 100 objects to destination elasticsearch, wrote 100 Mon, 11 Feb 2019 09:29:51 GMT | got 100 objects from source elasticsearch (offset: 200) Mon, 11 Feb 2019 09:30:13 GMT | sent 100 objects to destination elasticsearch, wrote 100 Mon, 11 Feb 2019 09:30:13 GMT | got 100 objects from source elasticsearch (offset: 300) Mon, 11 Feb 2019 09:30:39 GMT | sent 100 objects to destination elasticsearch, wrote 100 Mon, 11 Feb 2019 09:30:39 GMT | got 100 objects from source elasticsearch (offset: 400) Mon, 11 Feb 2019 09:31:53 GMT | sent 100 objects to destination elasticsearch, wrote 100 Mon, 11 Feb 2019 09:31:53 GMT | got 100 objects from source elasticsearch (offset: 500) Mon, 11 Feb 2019 09:32:28 GMT | sent 100 objects to destination elasticsearch, wrote 100 Mon, 11 Feb 2019 09:32:28 GMT | got 100 objects from source elasticsearch (offset: 600) Mon, 11 Feb 2019 09:33:24 GMT | sent 100 objects to destination elasticsearch, wrote 100 Mon, 11 Feb 2019 09:33:24 GMT | got 100 objects from source elasticsearch (offset: 700) Mon, 11 Feb 2019 09:34:19 GMT | sent 100 objects to destination elasticsearch, wrote 100 Mon, 11 Feb 2019 09:34:19 GMT | got 7 objects from source elasticsearch (offset: 800) Mon, 11 Feb 2019 09:34:47 GMT | sent 7 objects to destination elasticsearch, wrote 7 Mon, 11 Feb 2019 09:34:47 GMT | got 0 objects from source elasticsearch (offset: 807) Mon, 11 Feb 2019 09:34:47 GMT | Total Writes: 807 Mon, 11 Feb 2019 09:34:47 GMT | dump complete [root@VM_8_24_centos bin]# curl10.2.100.24:9200/_cat/indices|grep reconciliationonline % Total% Received % XferdAverage SpeedTimeTimeTimeCurrent DloadUploadTotalSpentLeftSpeed 00000000 --:--:--0:00:16 --:--:--0yellow open reconciliationonlineKnZrsU-7TmWWBs-1-dBRrw 5 180704.3mb4.3mb 100 32578100 3257800201000:00:160:00:16 --:--:--7769