Sonarqube 7.9.1社区故障排除
我正试图在centos 7上安装SonarQube 7.9.1社区版和postgres,但当我启动该服务时,它失败了 我想在centos 7上设置postgres,但我不能。我已经试着和docker一起设置,我得到了相同的结果。启动SonarQube的唯一方法是使用H2,但它仅用于测试目的 这是日志显示的唯一错误Sonarqube 7.9.1社区故障排除,sonarqube,Sonarqube,我正试图在centos 7上安装SonarQube 7.9.1社区版和postgres,但当我启动该服务时,它失败了 我想在centos 7上设置postgres,但我不能。我已经试着和docker一起设置,我得到了相同的结果。启动SonarQube的唯一方法是使用H2,但它仅用于测试目的 这是日志显示的唯一错误 2019.07.17 05:52:11 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /op
2019.07.17 05:52:11 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.07.17 05:52:11 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.07.17 05:52:12 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.07.17 05:52:12 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.07.17 05:52:12 INFO app[][o.e.p.PluginsService] no modules loaded
2019.07.17 05:52:12 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
2019.07.17 05:52:19 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 78
2019.07.17 05:52:19 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.07.17 05:52:19 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
我不知道该服务为什么会死掉,但我希望使用postgres设置该服务。您的系统不允许根据行映射每个进程的足够内存 [1] :max virtual memory areas vm.max_map_count[65530]过低,请至少增加到[262144] 在尝试启动SonarQube或发出
docker compose
命令之前,请运行以下命令:
sysctl -w vm.max_map_count=262144
错误:
loaded plugin [org.elasticsearch.transport.Netty4Plugin] ERROR: [1] bootstrap checks failed. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144].
解决方案:
loaded plugin [org.elasticsearch.transport.Netty4Plugin] ERROR: [1] bootstrap checks failed. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144].
Elasticsearch使用MMap FS目录存储其索引。默认操作系统对mmap计数的限制可能太低,这可能导致内存不足异常。输入以下命令以使用sudo权限增加虚拟内存值
$ sudo sysctl -w vm.max_map_count=262144
========================================
输出:
$ sudo sysctl -w vm.max_map_count=262144
vm.max_map_count = 262144
要永久设置值,请更新/etc/sysctl.conf中的vm.max\u map\u计数值。要在重新启动后进行验证
$ sysctl vm.max_map_count
这个答案并没有提供一个解决方案,但它可以解释为什么有些人可能无法在他们的虚拟服务器上启动和运行elsaticsearch 我也有同样的问题,但我无法更改值
vm.max\u map\u count
。运行sysctl--system并将vm.max\u map\u count=262144
添加到文件/usr/lib/sysctl.d/99 elasticsearch.conf
*正在应用/usr/lib/sysctl.d/99-elasticsearch.conf。。。
sysctl:设置键“vm.max\u map\u count”:日期顺序不正确
花了一段时间之后,我的虚拟CentOS7服务器在WSL上运行。WSL不支持设置所有内核参数,并且vm.max\u map\u count
就是其中之一()。提供的答案显示了如何在主机系统上设置值
我的回答显示了如果不能在主机系统本身上设置系统值,如何在kubernetes init容器中设置值
此解决方案取自。
如果您正在使用头盔,您可能希望使用sonarqube头盔图表本身,它已经包含了解决方案
apiVersion: v1
kind: ConfigMap
metadata:
name: sonarqube-sonarqube-init-sysctl
labels:
app: sonarqube
data:
init_sysctl.sh: |-
if [[ "$(sysctl -n vm.max_map_count)" -lt 524288 ]]; then
sysctl -w vm.max_map_count=524288
fi
if [[ "$(sysctl -n fs.file-max)" -lt 131072 ]]; then
sysctl -w fs.file-max=131072
fi
if [[ "$(ulimit -n)" != "unlimited" ]]; then
if [[ "$(ulimit -n)" -lt 131072 ]]; then
echo "ulimit -n 131072"
ulimit -n 131072
fi
fi
if [[ "$(ulimit -u)" != "unlimited" ]]; then
if [[ "$(ulimit -u)" -lt 8192 ]]; then
echo "ulimit -u 8192"
ulimit -u 8192
fi
fi
---
...
initContainers:
- name: init-sysctl
image: busybox:1.32
imagePullPolicy: IfNotPresent
securityContext:
privileged: true
resources:
{}
command: ["sh",
"-e",
"/tmp/scripts/init_sysctl.sh"]
volumeMounts:
- name: init-sysctl
mountPath: /tmp/scripts/
containers:
- name: sonarqube
image: sonarqube:...
...
volumes:
- name: init-sysctl
configMap:
name: sonarqube-sonarqube-init-sysctl
items:
- key: init_sysctl.sh
path: init_sysctl.sh
- name: sonar-data
备注
这个答案并不完全适用于这个问题,但在kubernetes中运行sonarqube时,它给出了相同问题的解决方案。我建议您在k8s清单中添加参数
-Dsonar.search.javaAdditionalOpts=-Dnode.store.allow_mmap=false
例如:
spec:
containers:
- image: sonarqube:8.8-community
args:
- -Dsonar.web.context=/sonar
- -Dsonar.search.javaAdditionalOpts=-Dnode.store.allow_mmap=false
是同一个错误,还是略有不同?如果您没有直接为fs.file max`配置值,但是应用了vm.max\u映射
设置,那么我希望您也会得到一个关于fs.file max
的错误。如果是相同的错误,你能提供运行sysctl vm.max_map_count
的输出吗?不,是相同的错误:``2019.07.17 21:23:41信息应用[][o.e.p.PluginsService]没有加载模块2019.07.17 21:23:41信息应用[][o.e.p.PluginsService]加载插件[org.elasticsearch.transport.Netty4Plugin]错误:[1]引导检查失败[1]:elasticsearch进程的最大文件描述符[4096]太低,至少增加到[65535]2019.07.17 21:23:49警告应用程序[][o.s.a.p.AbstractManagedProcess]进程已退出,退出值为[es]:78``请提供运行sysctl vm.max\u map\u count
的输出,好吗?这是输出:``vm.max\u map\u count=262144``啊,这是第二个警告给你的文件描述符。您需要运行sysctl-w fs.file max=65535来修复第二个错误。这需要在容器内或主机上运行吗?您必须添加安装sonarqube的位置。我已经测试过,但不是这样。。。。您需要在docker主机上运行此命令,而不是在安装sonarqube的容器中运行。请在主机上设置此命令。别忘了sysctl--system
或重启