User Tools

Site Tools


elasticsearch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
elasticsearch [2018/08/09 16:07]
k2patel [Quick Commands]
elasticsearch [2021/01/25 23:37]
k2patel
Line 5: Line 5:
 <code bash> <code bash>
 curl -XGET '​http://​localhost:​9200/​_cluster/​health?​pretty=true'​ curl -XGET '​http://​localhost:​9200/​_cluster/​health?​pretty=true'​
-</​code>​ 
- 
-== Node Information == 
-<code bash> 
-curl -XGET '​http://​localhost:​9200/​_nodes?​pretty=true'​ 
 </​code>​ </​code>​
  
Line 20: Line 15:
 <code bash> <code bash>
 curl -XGET '​http://​localhost:​9200/​_cat/​shards'​ curl -XGET '​http://​localhost:​9200/​_cat/​shards'​
 +</​code>​
 +
 +== Unassigned shard | timeout ==
 +**Try restarting**
 +<code bash>
 +curl -XPOST -k https://​admin:<​password>​@<​hostname>:​9200/​_cluster/​reroute?​retry_failed=true --CApath /​etc/​elasticsearch/​root-ca-key.pem
 +</​code>​
 +**List indexes not assigned**
 +<code bash>
 +curl -k --CApath /​etc/​elasticsearch/​root-ca-key.pem -XGET https://​admin:<​password>​@<​hostname>:​9200/​_cat/​shards?​h=index,​shard,​prirep,​state,​unassigned.reason | grep -i UNASSIGNED
 +</​code>​
 +**Detailed information on issue**
 +<code bash>
 +curl -k --CApath /​etc/​elasticsearch/​root-ca-key.pem -XGET https://​admin:<​password>​@<​hostname>:​9200/​_cluster/​allocation/​explain?​pretty
 </​code>​ </​code>​
  
Line 123: Line 132:
     }     }
 }' }'
 +</​code>​
 +
 +==== Rolling Upgrade ====
 +:!: This should work on elastic.co but my steps are mainly taken from the Opendistro.
 +
 +=== Set the cluster in upgrade mode ===
 +<code bash>
 +curl -k -XPOST https://​admin:<​password>​@<​hostname>:​9200/​_ml/​set_upgrade_mode?​enabled=true
 +</​code>​
 +
 +=== Disable sharding ===
 +<code bash>
 +curl -k -H '​Content-Type:​ application/​json'​ -XPUT -d '{
 +"​persistent":​ {
 +    "​cluster.routing.allocation.enable":​ "​primaries"​
 +  }
 +}' https://​admin:<​password>​@<​hostname>:​9200/​_cluster/​settings --CApath /​etc/​elasticsearch/​root-ca-key.pem
 +</​code>​
 +
 +=== Flush / Sync data on all host in cluster ===
 +<code bash>
 +curl -k -XPOST https://​admin:<​password>​@<​hostname>:​9200/​_flush/​synced --CApath /​etc/​elasticsearch/​root-ca-key.pem
 +</​code>​
 +
 +=== Stop / Upgrade / start Services ===
 +<code bash>
 +systemctl stop kibana.service
 +systemctl stop elasticsearch.service
 +dnf install opendistroforelasticsearch-1.12.0 -y
 +dnf install opendistroforelasticsearch-kibana-1.12.0 -y
 +systemctl start elasticsearch.service
 +systemctl start kibana.service
 +</​code>​
 +
 +=== Enable Sharding ===
 +<code bash>
 +curl -k -H '​Content-Type:​ application/​json'​ -XPUT -d '{
 +"​persistent":​ {
 +    "​cluster.routing.allocation.enable":​ "​all"​
 +  }
 +}' https://​admin:<​password>​@<​hostname>:​9200/​_cluster/​settings --CApath /​etc/​elasticsearch/​root-ca-key.pem
 +</​code>​
 +
 +==== Node Information ====
 +=== List all nodes and important information ===
 +:​!:​[[https://​www.elastic.co/​guide/​en/​elasticsearch/​reference/​current/​cat-nodes.html | Document Ref.]]
 +<code bash>
 +curl -XGET -k https://​admin:<​password>​@<​hostname>:​9200/​_cat/​nodes?​v=true\&​h=id,​ip,​port,​v,​m,​hp,​l,​r,​j,​fdc,​fdm
 </​code>​ </​code>​
elasticsearch.txt ยท Last modified: 2021/01/25 23:41 by k2patel