Node.js/ElasticSearch:修订间差异
来自康健生活
< Node.js
| 第36行: | 第36行: | ||
== 迁移 == | == 迁移 == | ||
=== elasticdump === | === elasticdump === | ||
{{shc|<syntaxhighlight lang="bash"> | |||
npm install elasticdump</syntaxhighlight>|$|/home/kangkk}} | |||
导出数据 | 导出数据 | ||
2021年5月28日 (五) 12:06的版本
引言
ElasticSearch,文档
服务器安装 elasticsearch 需要依赖 java
/home/kangkk
yum install java -y
[jian@kang /home/kangkk]$
java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
下载并安装 GPG key
/home/kangkk
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
添加 yum 仓库
/home/kangkk
vi /etc/yum.repos.d/elasticsearch.repo
/etc/yum.repos.d/elasticsearch.repo
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
安装 elasticsearch
/home/kangkk
yum install elasticsearch
迁移
elasticdump
/home/kangkk
npm install elasticdump
导出数据
[jian@kang /home/kangkk]$
./node_modules/elasticdump/bin/elasticdump --input http://用户名:密码@IP:端口/索引名称 --output ./索引名称_mapping.json --type=mapping
Fri, 28 May 2021 10:59:42 GMT | starting dump
Fri, 28 May 2021 10:59:42 GMT | got 1 objects from source elasticsearch (offset: 0)
Fri, 28 May 2021 10:59:42 GMT | sent 1 objects to destination file, wrote 1
Fri, 28 May 2021 10:59:42 GMT | got 0 objects from source elasticsearch (offset: 1)
Fri, 28 May 2021 10:59:42 GMT | Total Writes: 1
Fri, 28 May 2021 10:59:42 GMT | dump complete
[jian@kang /home/kangkk]$
./node_modules/elasticdump/bin/elasticdump --input http://用户名:密码@IP:端口/索引名称 --output ./索引名称.json --type=data
Fri, 28 May 2021 11:00:01 GMT | starting dump
Fri, 28 May 2021 11:00:01 GMT | got 100 objects from source elasticsearch (offset: 0)
Fri, 28 May 2021 11:00:01 GMT | sent 100 objects to destination file, wrote 100
Fri, 28 May 2021 11:00:02 GMT | got 100 objects from source elasticsearch (offset: 100)
Fri, 28 May 2021 11:00:02 GMT | sent 100 objects to destination file, wrote 100
...
Fri, 28 May 2021 11:00:32 GMT | sent 55 objects to destination file, wrote 55
Fri, 28 May 2021 11:00:32 GMT | got 0 objects from source elasticsearch (offset: 3455)
Fri, 28 May 2021 11:00:32 GMT | Total Writes: 3455
Fri, 28 May 2021 11:00:32 GMT | dump complete
taskrabbit/elasticsearch-dump
配置
No categories