- 确保存在node和npm
wget -c https://nodejs.org/dist/v16.18.1/node-v16.18.1-linux-x64.tar.xz
xz -d node-v16.18.1-linux-x64.tar.xz
tar -xf node-v16.18.1-linux-x64.tar
mv node-v16.18.1-linux-x64 /usr/local/nodejs
sudo mv node-v16.18.1-linux-x64 /usr/local/nodejs
cd /usr/local/nodejs/
或者
sudo ln -sf /usr/local/nodejs/bin/node /usr/local/bin/node
sudo ln -sf /usr/local/nodejs/bin/npm /usr/local/bin/npm
vim /etc/profile
添加node环境变量
export NODE_HOME=/usr/local/nodejs/
export PATH=NODE_HOME/bin:PATH
source /etc/profile
- 下载elasticdump
npm install -g elasticdump
如果出现错误:npm install elasticdump -g
[..................] - fetchMetadata: sill fetchPackageMetaData error for request@npm:@cypress/request@^3.0.1 Invalid dependency type requested: alias
解决: 可以先切换镜像
npm config set registry https://registry.npm.taobao.org
然后在执行: npm install elasticdump -g
3. 安装好后,elasticdump --version 查看版本
4. 查看 elasticdump位置whereis elasticdump
elasticdump: /usr/local/nodejs/bin/elasticdump
- 导出
/usr/local/nodejs/bin/elasticdump --input=http://192.168.x.y:9200/zhihu_ref --output=/u01/isi/develop/zhihu_ref_20231013.json