curl -XGET 'http://localhost:9200'
curl 'http://localhost:9200/_cluster/health?pretty'
curl 'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=50s&pretty'
curl 'http://localhost:9200/_cluster/state?pretty'
curl 'http://localhost:9200/_cluster/stats?human&pretty'
curl 'http://localhost:9200/_cluster/pending_tasks?pretty'
curl 'http://localhost:9200/_cluster/settings?include_defaults=true&flat_settings=true&pretty'
Add or modify the following lines in elasticsearch.yml to set the desired disk watermark levels and their corresponding percentages:
cluster.routing.allocation.disk.watermark.low: 85%
cluster.routing.allocation.disk.watermark.high: 90%
cluster.routing.allocation.disk.watermark.flood_stage: 95%
low
Elasticsearch starts allocating new shards to nodes with disk usage below this level.
high
Elasticsearch starts throttling shard allocations to nodes with disk usage above this level.
flood_stage
Elasticsearch prevents shard allocations on nodes with disk usage above this level.
check current settings with:
curl -s 'http://localhost:9200/_cluster/settings?include_defaults=true&flat_settings=true&pretty' | grep watermark
curl -XPOST 'localhost:9200/_flush/synced'
curl -XPUT localhost:9200/_cluster/settings -d '{
"transient" :{
"cluster.routing.allocation.exclude._ip" : "1.2.3.4"
}
}';echo
curl -XPUT localhost:9200/_cluster/settings -d '{
"transient" :{
"indices.recovery.max_bytes_per_sec" : "80mb"
}
}';echo
curl -XPUT localhost:9200/_cluster/settings -d '{
"transient" :{
"indices.recovery.concurrent_streams" : 6
}
}';echo
curl 'http://localhost:9200/_nodes?pretty'
curl 'http://localhost:9200/_nodes/stats?pretty'
curl 'http://localhost:9200/_nodes/nodeId1,nodeId2/stats?pretty'
curl 'http://localhost:9200/_cat/nodes?v=true'
curl -XPUT localhost:9200/_cluster/settings -d '{
"transient" :{
"cluster.routing.allocation.exclude._ip" : "1.2.3.4"
}
}';echo
curl -X GET 'http://localhost:9200/_cat/indices?v'
curl -X DELETE 'http://localhost:9200/examples'
curl -XPOST --header 'Content-Type: application/json' http://localhost:9200/_reindex -d '{
"source": {
"index1": "someexamples"
},
"dest": {
"index2": "someexamples_copy"
}
}'
curl -XPUT --header 'Content-Type: application/json' 'http://localhost:9200/_index_name_/_settings' -d '{
"index" : {
"number_of_replicas" : 1
}
}'
curl -X PUT "127.0.0.1:9200/.*/_settings" -H 'Content-Type: application/json' -d'{ "index" : { "number_of_replicas" : 0 } }'
curl -X GET 'http://localhost:9200/elasticsearch_query_examples/_search'
rpm -q opensearch
opensearch-2.19.0-1.x86_64
curl -s -XGET localhost:9200/_cat/indices | grep yell
yellow open top_queries-2025.02.22-91903 8dXcpNv9QTyciYQCVzKmkQ 1 1 4433 1522 11.8mb 11.8mb
yellow open top_queries-2025.02.23-91904 CFNMBEGBSnieQ5oYsM3Q8g 1 1 7127 1513 16.1mb 16.1mb
curl -s -X GET "localhost:9200/_cluster/settings?include_defaults=true&flat_settings=true" | jq '.defaults."cluster.default_number_of_replicas"'
"1"
vim /etc/opensearch/opensearch.ymlcluster.default_number_of_replicas: 0
systemctl restart opensearch
curl -s -X GET "localhost:9200/_cluster/settings?include_defaults=true&flat_settings=true" | jq '.defaults."cluster.default_number_of_replicas"'
"0"
curl https://raw.githubusercontent.com/joe-speedboat/linux.scripts/refs/heads/master/shell/opensearch_template_replica_debug.sh | bash
curl -X PUT "127.0.0.1:9200/top_queries-*/_settings" -H 'Content-Type: application/json' -d'
{
"index": {
"number_of_replicas": 0
}
}'
curl -s -XGET localhost:9200/_cat/indices | grep top_quer
green open top_queries-2025.02.22-91903 8dXcpNv9QTyciYQCVzKmkQ 1 0 4433 1522 11.8mb 11.8mb
green open top_queries-2025.02.23-91904 CFNMBEGBSnieQ5oYsM3Q8g 1 0 7127 1513 16.1mb 16.1mb
curl -XGET localhost:9200/_cat/shards?v
curl -X GET 'http://localhost:9200/_cat/shards/graylog_39?v'
curl -XPOST 'http://localhost:9200/_cluster/reroute' -d '{
"commands" : [
{
"move" :
{
"index" : "indexname", "shard" : 1,
"from_node" : "nodename", "to_node" : "nodename"
}
}
]
}';echo
curl -XPOST 'http://localhost:9200/_cluster/reroute?explain' -d '{
"commands" : [ {
"allocate" : {
"index" : "indexname", "shard" : 0, "node" : "nodename"
}
} ]
}';echo
curl http://localhost:9200/_cluster/health?pretty
curl -XGET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason
curl -XGET http://localhost:9200/_cat/shards | grep UNASSIGNED | awk {'print $1'} | xargs -i curl -XDELETE "http://localhost:9200/{}"
curl -XGET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason
curl http://localhost:9200/_cluster/health?pretty