SonarQube: embedded elasticsearch configuration location

假装没事ソ 提交于 2020-01-16 09:04:12

问题


I'm trying to run SonarQube on a server with ~2TB disk space, and only ~50G free space. When trying to use docker as in the official manual (nothing special), elasticsearch fails with a message about the read-only index. As far as I can get, this happens because it hits the flood_stage watermark, which is set to 95% by default. I'm pretty sure that we can set this watermark (and all others) to non-percentage smaller values, but I can't seem to find the configuration file, which the embedded elasticsearch is using. I've tried /opt/sonarqube/conf/elasticsearch.yml (which did not exist, needed to create it) and /opt/sonarqube/elasticsearch/config/elasticsearch.yml, which contained the default elasticsearch configuration.

Even when writing complete non-yml gibberish into these files, elasticsearch fails with the same error, so I'm pretty sure that these are not the files that are in use. I have also tried to search through the documentation, but it seems that the only hint it contains about this behaviour is "increase the disk space, and delete all indexes". So, what files should I use to configure embedded elasticsearch?

UPD: We have ended up monkey-patching the /opt/sonarqube/elasticsearch/bin/elasticsearch startup script to insert additional lines into the dynamically generated config (which is located in /opt/sonarqube/temp/conf/es/elasticsearch.yml btw). Not a clean solution, but this seems to be the simplest, considering how sonarqube generates the config dynamically


回答1:


for changing watermark setting, you can use dynamic cluster update setting: https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html

for watermark, something like this:

curl -s -XPUT 'localhost:9200/_cluster/settings?pretty' -d '
{
    "persistent" : {
        "cluster.routing.allocation.disk.watermark.flood_stage" : "99%"
    }
}'


来源:https://stackoverflow.com/questions/57227388/sonarqube-embedded-elasticsearch-configuration-location

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