-
Notifications
You must be signed in to change notification settings - Fork 0
/
esg
48 lines (40 loc) · 797 Bytes
/
esg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
opt=$1
function replicas(){
shift
echo "replicaNumber...${1}"
cc=`curl 'localhost:9200/_cat/indices?v'|awk '{if (NR>1) print $3}'`
for c in $cc; do
curl -XPUT "localhost:9200/${c}/_settings" -d '{
"index": {
"number_of_replicas": "${rep}"
}
}'
done
}
function del(){
cc=`curl 'localhost:9200/_cat/indices?v'|awk '{if (NR>1) print $3}'`
read -r -p '确认删除?[y/N]' cs
case ${cs} in
[yY][eE][sS]|[yY])
echo "checking...${cs}!"
for c in $cc; do
curl -XDELETE "localhost:9200/${c}"
done
;;
*)
;;
esac
}
if [ ${opt} = 'rep' ]
then
echo "opt replicas"
replicas $@
exit $?
fi
if [ ${opt} = 'del' ]
then
echo "opt del"
del
exit $?
fi