Elasticsearch备份脚本
# 1.备份date文件
按每周轮播储存
# 2.shell脚本
#!/bin/bash
XWEEK=$(date "+%w")
XTIME=$(date "+%Y-%m-%d,%H:%m:%s")
XDATANAME=data_${XWEEK}.tar.gz
XLOGNAME=excute_${XWEEK}.log
XPATH=/home/summer/elasticsearch-6.3.1/databak
mkdir -p ${XPATH}
cd ${XPATH}
echo " ${XTIME}: start delete last version" > ${XLOGNAME}
rm -rf ${XDATANAME}
XTIME=$(date "+%Y-%m-%d,%H:%m:%s")
echo " ${XTIME}: end delete last version,start bak data" >> ${XLOGNAME}
tar -cvzf ${XPATH}/${XDATANAME} ../data
XTIME=$(date "+%Y-%m-%d,%H:%m:%s")
echo " ${XTIME}: end bak data" >> ${XLOGNAME}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18