docker安装的sonarqube,之前安装后运行一直都正常,今天第二次启动的时候,就会自动关闭。
通过命令查看日志:
docker logs --since 30m da005eba84b7
2021.11.12 01:13:05 INFO es[][o.e.n.Node] initialized
2021.11.12 01:13:05 INFO es[][o.e.n.Node] starting ...
2021.11.12 01:13:05 INFO es[][o.e.t.TransportService] publish_address {127.0.0.1:36579}, bound_addresses {127.0.0.1:36579}
2021.11.12 01:13:07 INFO es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /opt/sonarqube/logs/sonarqube.log
2021.11.12 01:13:07 INFO es[][o.e.n.Node] stopping ...
2021.11.12 01:13:07 INFO es[][o.e.n.Node] stopped
2021.11.12 01:13:07 INFO es[][o.e.n.Node] closing ...
2021.11.12 01:13:07 INFO es[][o.e.n.Node] closed
2021.11.12 01:13:07 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 78
2021.11.12 01:13:07 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2021.11.12 01:13:07 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
2021.11.12 01:18:21 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2021.11.12 01:18:21 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:43899]
现在需要修改文件:
vi /etc/sysctl.d/99-sysctl.conf
fs.file-max = 2097152
vm.max_map_count = 262144
vm.swappiness = 1
然后,运行命令:
sysctl -p