问题
I'm writing an internal manual for SonarQube administration but after getting ElasticSearch engine into the product I have not been able to close the circle. Before this, a DB backup and copy some folders where enough to save SQ status, but what should I do now with ElasticSearch?
Should I simply use one more node of ES so to have a live duplicate of indexes? Should I make a copy of the new node shards and keep it as backup? And how can I restore the SQ status if required?
回答1:
No need to backup the ElasticSearch index, SonarQube will re-create it if needed. Basically, if you need to restore a DB backup then:
- stop SonarQube
- wipe-out the existing index under sonar_install_dir/es
- restore your DB backup
- restart SonarQube
At that point SonarQube will automatically re-create the index (may take some time depending on volume of data).
回答2:
When you create the index, you can define how many replica shards you want (default is 5). They are just copies of the primary shards.
Like this example from the manual (here one replica per primary shard):
PUT /blogs
{
"settings" : {
"number_of_shards" : 3,
"number_of_replicas" : 1
}
}
Then as you scale out (add more nodes with ES installed), you give the nodes the same cluster.name
as the first one. The replicas will be automagically allocated/moved to the new nodes.
Check this out: https://www.elastic.co/guide/en/elasticsearch/guide/current/_add_failover.html
来源:https://stackoverflow.com/questions/42340757/sonarqube-backup-restore-procedure-with-elasticsearch