Rolling Upgrades

Preparation

curl -u $USER:$PASSWORD "http://localhost:9200/_cluster/health?pretty"

curl -u $USER:$PASSWORD "localhost:9200/_cluster/settings" -H "Content-Type: application/json" -d '{
  "persistent": {
    "cluster.routing.allocation.enable": "primaries"
  }
}'

curl -u $USER:$PASSWORD "localhost:9200/_flush/synced?pretty"

Node Upgrade Process

curl -u $USER:$PASSWORD "localhost:9200/_cluster/settings" -H "Content-Type: application/json" -d '{
  "transient": {
    "cluster.routing.allocation.exclude._name": "node-to-upgrade"
  }
}'

curl -u $USER:$PASSWORD "localhost:9200/_cat/shards?v" | grep node-to-upgrade

Post-Upgrade Tasks

  1. Start Energylogserver service

systemctl start logserver
  1. Delete .auth index

curl -u$USER:$PASSWORD -X DELETE localhost:9200/.auth
  1. Use elasticdump to get all templates and load it back

  • get templates

/usr/share/logserver-gui/elasticdump/elasticdump  --output=http://logserver:logserver@localhost:9200 --input=templates_elasticdump.json --type=template
  • delete templates

for i in `curl -ss -ulogserver:logserver http://localhost:9200/_cat/templates | awk '{print $1}'`; do curl -ulogserver:logserver -XDELETE http://localhost:9200/_template/$i ; done
  • load templates

/usr/share/logserver-gui/elasticdump/elasticdump  --input=http://logserver:logserver@localhost:9200 --output=templates_elasticdump.json --type=template
  1. Open indexes that were closed before the upgrade, example of query:

curl -ss -u$USER:$PASSWORD "http://localhost:9200/_cat/indices/winlogbeat*?h=i,s&s=i" |awk '{if ($2 ~ /close/) system("curl -ss -u$USER:$PASSWORD -XPOST http://localhost:9200/"$1"/_open?pretty")}'
  1. Start the Logserver-Probe service

systemctl start logserver-probe
  1. Enable Energylogserver allocation

curl -sS -u$USER:$PASSWORD -X PUT "http://localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d' { "persistent": {"cluster.routing.allocation.enable": "none"}}'
  1. After starting on GUI remove aliases .logserver-gui* (double version of index patterns)

curl -u$USER:$PASSWORD "http://localhost:9200/.logserver-gui_1/_alias/_all" -XDELETE
  1. Install new version of default base template

curl -k -XPUT -H 'Content-Type: application/json' -u logserver:logserver 'http://127.0.0.1:9200/_template/default-base-template-0' -d@/usr/share/logserver/default-base-template-0.json