安装
下载node下载 | Node.js 中文网
tar xvf node-v16.5.0-linux-x64.tar.xz
ln -s /app/temp/node-v16.5.0-linux-x64/bin/node /usr/bin/node
ln -s /app/temp/node-v16.5.0-linux-x64/bin/npm /usr/bin/npm
npm install elasticdump -g
npm config get cache
npm install --cache /root/.npm --optional --cache-min 99999999999 --shrinkwrap false elasticdump
strings /lib64/libc.so.6 |grep GLIBC_
tar zxvf glibc-2.17.tar.gz
cd glibc-2.17
mkdir build
cd build/
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make && make install
ln -s /usr/lib64/libstdc++.so.6.0.17 /usr/lib64/libstdc++.so.6
/app/node_modules/elasticdump/bin/elasticdump --input=http://*******/auth_all --output=/app/msy_index_mappingss1.json --type=mapping
elasticdump \--input=http://production.es.com:9200/my_index \--output=$ \| gzip > /data/my_index.json.gz
elasticdump \--input=http://*********/my_index \--output=$ \| gzip > /data/my_index.json.gz# 把一个查询结果备份到文件中
elasticdump \--input=http://************/my_index \--output=query.json \--searchBody '{"query":{"term":{"username": "admin"}}}'
#!/bin/bash
esdir=/app/es/bakdir
opdt_index=opdt_all
auth_index=auth_all
datat_type=data
mapping_type=mapping
datefile=`date +"%Y%m%d"`
IP=*****
PORT=*****
baktype=$1
if [ ! -d ${esdir} ];thenmkdir -p ${esdir}
fiif [ ! -d ${esdir}/${datefile} ];thenmkdir -p ${esdir}/${datefile}
fielasticdumpbak ()
{index=$1baktype=$2/app/node_modules/elasticdump/bin/elasticdump --input=http://${IP}:${PORT}/${index} \--output=${esdir}/${datefile}/${index}-${baktype}-${datefile}.json --type=$baktype if [ $? -eq 0 ];thencd ${esdir}/${datefile}/tar czf ${index}-${baktype}-${datefile}.tar.gz ${index}-${baktype}-${datefile}.jsonrm -rf ${index}-${baktype}-${datefile}.jsonelseecho "${index}-${baktype}未备份成功">${esdir}/${index}-${baktype}.logfi
}elasticdumpbak $opdt_index $datat_type
elasticdumpbak $auth_index $datat_type
elasticdumpbak $opdt_index $mapping_type
elasticdumpbak $auth_index $mapping_type