柚子快报激活码778899分享:es备份
[root@es ~]# cat /data/elasticsearch-6.8.8/config/elasticsearch.yml
cluster.name: es_user
node.name: es-user01
path.data: /data/elasticsearch_data
path.repo: /data/elasticsearch/esbackup
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.1.1","192.168.1.2","192.168.1.3"]
discovery.zen.minimum_master_nodes: 2
discovery.zen.fd.ping_interval: 10s
discovery.zen.fd.ping_timeout: 120s
discovery.zen.fd.ping_retries: 6
xpack.security.enabled: false
[root@es ~]# cat /data/esbackup.sh
#!/bin/bash
echo """`date "+%F %T"` 开始备份ES"""
#LOCAL_IP=`ifconfig |grep eth0 -A1 |grep inet |awk -F" " '{print $2}'`
DAY=`date +%Y%m%d`
command=`curl -XPUT -u 'user:pwd' -w %{http_code} http://localhost:9200/_snapshot/esbackup/snapshot_${DAY}?wait_for_completion=true -d'
{
"indices": "*",
"ignore_unavailable": true,
"include_global_state": true
}' -H "Content-Type:application/json" -s`
OUTPUT=${command}
echo ${OUTPUT}
http_code=`echo ${OUTPUT: -3}`
if [[ "${http_code}" == "200" ]];then
echo -e """`date "+%F %T"` ES备份成功"""
else
echo -e """`date "+%F %T"` ES备份失败"""
fi
[root@es ~]#
柚子快报激活码778899分享:es备份
发表评论