Skip to content

Instantly share code, notes, and snippets.

@yolabingo
Last active January 6, 2022 22:09
Show Gist options
  • Save yolabingo/e69033e10c88f1f57847bbc298db9a77 to your computer and use it in GitHub Desktop.
Save yolabingo/e69033e10c88f1f57847bbc298db9a77 to your computer and use it in GitHub Desktop.

curl -k --user admin:PASS https://prod-es1:9200

/_cluster/health?pretty
/_cat/nodes?pretty
/_cluster/health?level=indices&pretty
/_cluster/health?level=shards&pretty

delete unassigned shards

curl -ks -u admin:admin https://elasticsearch:9200/_cat/shards?h=index,shards,state,prirep,unassigned.reason | grep UNASSIGNED | awk {'print $1'} | xargs -i curl -XDELETE -ks -u admin:admin https://elasticsearch:9200/{}

disable "read only" state for index

Probably triggered by low disk space

curl -XPUT -H "Content-Type: application/json" http://127.0.0.1:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

opendistro es has a security plugin enabled by default that forces https -

http does not work:

curl -XGET http://127.0.0.1:9200/_cat/nodes?v -u admin:admin curl: (52) Empty reply from server

https works:

curl -XGET https://localhost:9200/_cat/nodes?v -u admin:admin --insecure cluster.name: "docker-cluster"

to use http, add to the opendistro elasticsearch.yml:

opendistro_security.disabled: true
docker cp CONTAINER_ID:/usr/share/elasticsearch/config/elasticsearch.yml .

edit elasticsearch.yml in docker container

docker run -d -p 9200:9200 -p 9600:9600 -v /root/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -e discovery.type=single-node amazon/opendistro-for-elasticsearch:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment