-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhh_elastic.txt
104 lines (78 loc) · 3.28 KB
/
hh_elastic.txt
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Consultar el estado del cluster:
```bash
curl -XGET http://c04a:8902/_cluster/health?pretty -s
curl -XGET --user elastic:XXXXXX http://c04a:8902/_cluster/state?pretty -s
```
# Consultar el estado de todos los nodos de un cluster:
```bash
curl -XGET "http://c04a:8902/_nodes/_all/info?pretty" -s
```
# Consultar Info y estadísticas del cluster (docs., tamaño, etc)
```bash
curl -XGET "http://c04a:8902/_stats?pretty" -s
```
# Estado indices
```bash
curl -XGET --user elastic:XXXXXX -H 'Content-Type: application/json' 'http://ela01a:8932/_cat/indices?pretty' -s | grep -v "green"
```
# Estado de las colas
```bash
curl -kXGET --user elastic:XXXXXX -H 'Content-Type: application/json' 'https://elasticesm.edicom.es:443/_cat/thread_pool/?v' -s
curl -XGET --user elastic:XXXXXX -H 'Content-Type: application/json' 'http://ela01a:8902/_cat/thread_pool/?v&h=node_name,host,name,port,queue,queue_size,rejected,active,size,min,max,keep_alive'
```
# Para ver porque no se alojan los indices
```bash
curl -XGET localhost:9200/_cluster/allocation/explain?pretty
```
# Allocation
## ENABLE REALLOCATION:
```bash
curl -XPUT --user elastic:XXXXXX-H 'Content-Type: application/json' http://c04a:8902/_cluster/settings -d '{ "transient" : { "cluster.routing.allocation.enable" : "all" }}'
```
## DISABLE REALLOCATION:
```bash
curl -XPUT --user elastic:XXXXXX -H 'Content-Type: application/json' http://c04a:8902/_cluster/settings -d '{ "transient" : { "cluster.routing.allocation.enable" : "none" }}'
```
# Donarli chicha al allocation
```bash
curl -sSkLXPUT --user "XXXXX:XXXXXX" localhost:8922/_cluster/settings?pretty -d ' {"transient" : { "cluster" : {"routing" : {"allocation" : {"node_concurrent_recoveries" : "200", "cluster_concurrent_rebalance" : "200", "node_initial_primaries_recoveries" : "200" } } } } }' -H 'Content-Type: application/json'
```
# CHECK SETTINGS (entre ellas si el reallocation está ON/OFF):
```bash
curl -XGET --user elastic:XXXXXX http://c04a:8902/_cluster/settings?pretty
```
# Quitarle el tag de hotwarm
```bash
curl -XPUT -H 'Content-Type: application/json' -u elastic:XXXXXX "http://${ip_cluster}/${indice}/_settings" -d '{ "settings": { "index.routing.allocation.require.box_type" : null } }'
````
# Snapshot
## Ver snapshot
```bash
curl --user "elastic:XXXXXX" -sSkLXGET 'ela01c:8922/_snapshot/backup_elapool1/_all?pretty' | grep -E "\"state\"|\"snapshot\" : \"elapool1"
```
## Crear snapshot
```bash
PUT _snapshot/mo_es_offloading_index
```
## Crear el schedule de los snapshots
```bash
PUT /_slm/policy/daily_snapshot
{
"schedule" : "0 0/60 * * * ?",
"name": "<pla1-daily-snap-{now/d}>",
"repository": "mo_es_offloading_index",
"config": {
"indices": ["logstash-*"]
},
"retention": {
"expire_after": "60d",
"min_count": 5,
"max_count": 50
}
}
```
##################################################################
# KUBECONFIG
file=admin.conf.old; echo "$(cat $file| grep -i certificate | grep client |awk '{print $2}')" | base64 -d > /tmp/tmpfile; openssl x509 -in /tmp/tmpfile -text -noout
kubeadm alpha kubeconfig user --client-name kubernetes-admin --org system:masters > admin.conf
file=admin.conf ; echo "$(cat $file| grep -i certificate | grep client |awk '{print $2}')" | base64 -d > /tmp/tmpfile; openssl x509 -in /tmp/tmpfile -text -noout