1、 ES索引副本自动检测并设置副本,日志记录创建副本过程。
2、加入定时任务监控非副本自动设置。
cat es_fuben.sh
#!/bin/bash
#es集群自动设置副本脚本
#es集群IP地址配置
IP_ADD=192.168.1.1
ip=`/sbin/ip add |grep inet |grep -v inet6 |grep -v host |awk '{print $2}' |awk -F"/" '{print $1}'|head -1`
#日志
LOGS_TIME=`date "+%Y-%m"`
#查看集群副本状况
#curl -H 'Content-Type:application/json' -XGET http://$IP_ADD:9201/_cat/indices/?v -s |grep -v close|awk -v OFS=" number_of_replicas:" '{print $3,$6}'|grep "number_of_replicas:0"
curl -H 'Content-Type:application/json' -XGET http://$IP_ADD:9201/_cat/indices/?v -s |grep -v close|awk -v OFS=" number_of_replicas:" '{print $3,$6}'|grep "number_of_replicas:0" >/opt/shell/provided_name_list_fuben.txt
index_list=`cat /opt/shell/provided_name_list_fuben.txt|awk '{print $1}'`
for index_name in $index_list
do
#检查集群状