SonarQube:嵌入式Elasticsearch配置位置 [英] SonarQube: embedded elasticsearch configuration location

查看:132
本文介绍了SonarQube:嵌入式Elasticsearch配置位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在具有〜2TB磁盘空间和只有〜50G可用空间的服务器上运行SonarQube.当尝试像官方手册中一样使用docker(没什么特别的)时,elasticsearch失败,并显示一条有关只读索引的消息.据我所知,发生这种情况是因为它碰到了 flood_stage 水印,该水印默认情况下设置为95%.我很确定我们可以将此水印(以及所有其他水印)设置为非百分比的较小值,但是我似乎找不到嵌入式Elasticsearch使用的配置文件.我已经尝试过/opt/sonarqube/conf/elasticsearch.yml (尚不存在,需要创建它)和/opt/sonarqube/elasticsearch/config/elasticsearch.yml ,其中包含默认的elasticsearch配置.

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.

即使将完全非yml的乱码写入这些文件,elasticsearch也会失败,并出现相同的错误,因此,我很确定这些不是正在使用的文件.我也尝试搜索文档,但是似乎它包含的有关此行为的唯一提示是增加磁盘空间,并删除所有索引".那么,我应该使用哪些文件来配置嵌入式Elasticsearch?

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:我们最终完成了对/opt/sonarqube/elasticsearch/bin/elasticsearch 启动脚本的猴子修补,以将其他行插入动态生成的配置(位于/opt/sonarqube/temp/conf/es/elasticsearch.yml btw).考虑到sonarqube如何动态生成配置,这不是一个干净的解决方案,但这似乎是最简单的

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

推荐答案

要更改水印设置,可以使用动态集群更新设置: https://www.elastic.co/guide/zh-CN/elasticsearch/reference/current/cluster-update-settings.html

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

对于水印,是这样的:

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

这篇关于SonarQube:嵌入式Elasticsearch配置位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆