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?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
Once all shards have been moved off the node, proceed with the upgrade:
# Stop the service on the node being upgraded
systemctl stop logserver
# Run the upgrade script
./install.sh -u
# Start the service
systemctl start logserver
# Verify the node has rejoined the cluster before proceeding to the next node
curl -u $USER:$PASSWORD "localhost:9200/_cat/nodes?v"
Post-Upgrade Tasks
Start Energy Logserver service
systemctl start logserver
Delete .auth index
Warning
Deleting the .auth index will remove all saved authentication tokens and session data. Users will need to re-authenticate after this operation.
curl -u$USER:$PASSWORD -X DELETE localhost:9200/.auth
Use
elasticdumpto get all templates and load it back
Set credentials for the commands below:
export USER=logserver
export PASSWORD=your_password # Replace with your actual password
export templates
/usr/share/logserver-gui/elasticdump/elasticdump --input=http://$USER:$PASSWORD@localhost:9200 --output=templates_elasticdump.json --type=template
delete templates
for i in $(curl -sS -u$USER:$PASSWORD http://localhost:9200/_cat/templates | awk '{print $1}'); do curl -u$USER:$PASSWORD -XDELETE http://localhost:9200/_template/$i ; done
load templates
/usr/share/logserver-gui/elasticdump/elasticdump --output=http://$USER:$PASSWORD@localhost:9200 --input=templates_elasticdump.json --type=template
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")}'
Start the Network Probe service
systemctl start logserver-probe
Enable Energy Logserver 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": "all"}}'
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
Install new version of default base template
curl -k -XPUT -H 'Content-Type: application/json' -u $USER:$PASSWORD 'http://127.0.0.1:9200/_template/default-base-template-0' -d@/usr/share/logserver/default-base-template-0.json