#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
if [ -z "$1" ]; then
ADAYAGO=`date --date="1 day ago" +%Y-%m-%d`
else
ADAYAGO="$1"
fi
echo "Starting $ADAYAGO"
QUERY_STR='{"query":{"range":{"timestamp":{"gte":"'"$ADAYAGO "'00:00:00.000","lte":"'"$ADAYAGO"' 23:59:59.999"}}}}'
EXPORT_PATH=/home/sgeuser/elasticsearch
EXPORT_FILE_NAME=esbackup.$ADAYAGO.json
es-export-bulk --url http://localhost:9200 --file $EXPORT_PATH/$EXPORT_FILE_NAME --body "$QUERY_STR"
ls -lh $EXPORT_PATH/$EXPORT_FILE_NAME
gzip -9 $EXPORT_PATH/$EXPORT_FILE_NAME
md5sum $EXPORT_PATH/$EXPORT_FILE_NAME.gz > $EXPORT_PATH/$EXPORT_FILE_NAME.gz.hash
sha1sum $EXPORT_PATH/$EXPORT_FILE_NAME.gz >> $EXPORT_PATH/$EXPORT_FILE_NAME.gz.hash
sha256sum $EXPORT_PATH/$EXPORT_FILE_NAME.gz >> $EXPORT_PATH/$EXPORT_FILE_NAME.gz.hash
when i run my command line it gives air?
es-export-bulk --url http://localhost:9200 --file $EXPORT_PATH/$EXPORT_FILE_NAME --body "$QUERY_STR"
fs.js:646
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
Error: EISDIR: illegal operation on a directory, open '/'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.writeFileSync (fs.js:1299:33)
at Object.<anonymous> (/usr/local/lib/node_modules/elasticsearch-tools/lib/es-export-bulk.js:279:6)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
There looks to be a problem with your script, not with Elasticsearch. You might be able to diagnose it by adding set -x to the top of your script and running it again, to see what it is doing.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.