Open2
Elasticsearch周りのメモ
network.host
の設定次第では、curl localhost:9200
がconnection refuseになる
// 下記のような場合はcurl http://${hostname}:9200 でRequestが通る
# cat /etc/elasticsearch/elasticsearch.yml
...
network:
host: _gce:hostname_
NodeのRolling upgrade (Es Cluster構成)
- 概要
- shardの移動を事前に止める (
/_cluster/settings
) - Nodeの再起動時も含めてshardの移動を継続的に止める際には
persistent
の設定を利用するtransient, where they don't survive a full cluster restart
- (最後に元に戻すのは必ず忘れないこと)
- shardの状況は
/_cat/shards?v
で確認できる
- shardの移動を事前に止める (
// 利用するコマンド(一部省略)
// 事前にshard, indexなどのstatusを確認する
curl http://$(hostname):9200/_cat/indices?v
// shardの移動を停止
curl -X PUT -H 'Content-Type: application/json' http://$(hostname):9200/_cluster/settings -d'
{
"persistent": {
"cluster.routing.allocation.enable": "none"
}
}'
// shardの状況は下記で確認できる
curl http://$(hostname):9200/_cat/shards?v | sort
curl http://$(hostname):9200/_cat/shards?v | sort | grep UNASSIGNED
// shardの移動をenableにする
curl -X PUT -H 'Content-Type: application/json' http://$(hostname):9200/_cluster/settings -d'
{
"persistent": {
"cluster.routing.allocation.enable": "all"
}
}'
// shardの移動をenableにした上で、shard, clusterのstatus確認を行う
curl http://$(hostname):9200/_cluster/health?pretty