Thank you for reading this post, don't forget to subscribe!
kubectl exec -ti -n prod elasticsearch-master-0 bash
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[elasticsearch@elasticsearch-master-0 ~]$ curl -XGET http://localhost:9200/_cat/shards spm-pages-1647302400 0 p STARTED 47911 62.2mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1673398800 0 p STARTED 49500 57.5mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1672880400 0 p STARTED 57500 72.6mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1674090000 0 p STARTED 36500 41.7mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1631180221 0 p STARTED 23500 29.9mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1661472000 0 p STARTED 43500 54mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1661780508 0 p STARTED 31000 44.8mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1671670800 0 p STARTED 17000 19.5mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1676509200 0 p STARTED 63197 83.6mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1671238800 0 p STARTED 5500 6.5mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1631103926 0 p STARTED 45329 56.8mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1646874000 0 p STARTED 47880 62.6mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1671152400 0 p STARTED 5 64.6kb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1671152400 0 r UNASSIGNED spm-pages-1657756800 0 p STARTED 48984 67.4mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1661385600 0 p STARTED 44000 54.8mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1657324800 0 p STARTED 48997 67.5mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1631181636 0 p STARTED 18000 23mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1660726577 0 p STARTED 39500 56.1mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1660694400 0 p STARTED 36500 42.5mb 10.20.38.5 spm-elasticsearch-master-0 spm-pages-1649916567 0 p STARTED 34000 46.6mb 10.20.38.5 spm-elasticsearch-master-0 |
вот этот индекс битый:
spm-pages-1671152400 0 r UNASSIGNED
удалить все битые индексы можно следующей командой:
curl -XGET http://localhost:9200/_cat/shards | grep UNASSIGNED | awk {'print $1'} | xargs -i curl -XDELETE "[http://localhost:9200/{}]
когда нужно посмотреть все индексы
curl -k -u elastic:PASSWORD -XGET https://localhost:9200/_cat/indices
когда нужно удалить индексы
curl -k -u elastic:PASSWORD -XDELETE https://localhost:9200/apm-7.17.3-error-000003
проверить что shards восстанавливаются
curl -k -u elastic:PASSWORD -XGET https://localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
curl -k -u elastic:PASSWORD -XGET https://localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason .kibana_7.17.3_001 0 r STARTED .kibana_7.17.3_001 0 p STARTED apm-7.17.3-onboarding-2023.06.16 0 p STARTED apm-7.17.3-onboarding-2023.06.16 0 r STARTED .monitoring-kibana-7-2023.06.19 0 p STARTED .monitoring-kibana-7-2023.06.19 0 r UNASSIGNED REPLICA_ADDED filebeat-staging-2023.06.14 0 r STARTED filebeat-staging-2023.06.14 0 p STARTED .ds-.slm-history-5-2023.05.12-000002 0 p STARTED .ds-.slm-history-5-2023.05.12-000002 0 r UNASSIGNED REPLICA_ADDED .monitoring-kibana-7-2023.06.16 0 p STARTED .monitoring-kibana-7-2023.06.16 0 r UNASSIGNED REPLICA_ADDED .kibana_security_session_1 0 p STARTED .kibana_security_session_1 0 r STARTED .monitoring-es-7-2023.06.14 0 p STARTED .monitoring-es-7-2023.06.14 0 r UNASSIGNED REPLICA_ADDED apm-7.17.3-transaction-000003 0 p STARTED apm-7.17.3-transaction-000003 0 r UNASSIGNED CLUSTER_RECOVERED |