企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 安装node 使用 node 安装 elasticdump 非常方便。 node 官网:传送门 https://nodejs.org/en 下载版本:node-v12.14.0-linux-x64.tar.gz 安装环境:centos7.9 ### 创建nodejs文件夹 ``` cd /usr/local mkdir nodejs ``` ### 解压文件 ``` tar -xzvf node-v12.14.0-linux-x64.tar.gz ``` ### 移动nodejs文件 ``` mv node-v12.14.0-linux-x64/* /usr/local/nodejs ``` ### 建立软链接 此时的bin文件夹中已经存在node以及npm,如果你进入到对应文件的中执行命令行一点问题都没有,不过不是全局的,所以通过建立软链接的方式将这个设置为全局。 ``` ln -s /usr/local/nodejs/bin/node /usr/local/bin ``` ``` ln -s /usr/local/nodejs/bin/npm /usr/local/bin ``` ### 测试node ``` [root@ncayu8847 data]# node -v v12.14.0 [root@ncayu8847 data]# npm -v 6.13.4 ``` ## 安装打包工具 npm-pack-all ``` npm install -g npm-pack-all ``` 打包步骤 * 找到项目中node-modules; * 在node-modules中找到需要打离线包的依赖包; * 在上述的依赖包中找到node-modules; * 在终端中打开这个node-modules并执行npm-pack-all; * 在文件夹中打开执行npm-pack-all的路径,可以在当前或者下一级看到tgz包。 ## 安装elasticdump ``` npm install elasticdump -g ``` ``` [root@ncayu8847 data]# npm install elasticdump -g npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated s3signed@0.1.0: This module is no longer maintained. It is provided as is. /usr/local/nodejs/bin/multielasticdump -> /usr/local/nodejs/lib/node_modules/elasticdump/bin/multielasticdump /usr/local/nodejs/bin/elasticdump -> /usr/local/nodejs/lib/node_modules/elasticdump/bin/elasticdump + elasticdump@6.103.0 added 128 packages from 200 contributors in 58.933s [root@ncayu8847 data]# ``` ### 打包elasticdump 进入到elasticdump安装目录 ``` cd /usr/local/nodejs/lib/node_modules/elasticdump/ ``` 执行 npm-pack-all 当前目录生成 elasticdump-6.82.0.tgz ``` /usr/local/nodejs/lib/node_modules/npm-pack-all/index.js ``` ### npm 离线安装esdump ``` npm install elasticdump-6.84.1.tgz ``` ### 确认安装成功 elasticdump创建软连接 ``` ln -s /usr/local/nodejs/lib/node_modules/elasticdump/bin/elasticdump /usr/local/bin ``` ``` elasticdump --help ``` ## elasticdump备份ES数据库 迁移Setting和Mapping等 ``` elasticdump \ --input=http://192.168.1.1:9200/my_index \ --output=http://192.168.3.2:9200/my_index \ --type=analyzer elasticdump \ --input=http://192.168.1.1:9200/my_index \ --output=http://192.168.3.2:9200/my_index \ --type=settings elasticdump \ --input=http://192.168.1.1:9200/my_index \ --output=http://192.168.3.2:9200/my_index \ --type=mapping ``` 迁移数据 ``` elasticdump \ --input=http://192.168.1.1:9200/my_index \ --output=http://192.168.3.2:9200/my_index \ --type=data ``` ### 示例 ``` elasticdump \ --input='http://elastic:password@192.168.1.1:9200/my_index' \ --output=/data/my_index_mapping.json \ --type=mapping elasticdump \ --input='http://elastic:password@192.168.1.1:9200/my_index' \ --output=/data/my_index_index.json \ --type=data ```