SonarQube backup restore procedure with ElasticSearch

落爺英雄遲暮 提交于 2019-12-25 08:24:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!