查看 sonar 的 logs/sonar.log
2021.04.26 11:05:40 INFO app[][o.s.a.SchedulerImpl] Process[web] is stopped
2021.04.26 11:05:40 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2021.04.26 11:05:40 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2021.04.26 11:05:40 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
看到 es 报错 查看 logs/es.log
2021.04.26 11:05:27 INFO es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [61.6gb], net total_space [114.9gb], types [rootfs]
2021.04.26 11:05:27 INFO es[][o.e.e.NodeEnvironment] heap size [494.9mb], compressed ordinary object pointers [true]
2021.04.26 11:05:27 INFO es[][o.e.n.Node] node name [sonarqube], node ID [_Ewy-aLkTLKbdkGHHvPgBw]
2021.04.26 11:05:27 INFO es[][o.e.n.Node] version[6.8.4], pid[10075], build[default/tar/bca0c8d/2019-10-16T06:19:49.319352Z], OS[Linux/3.10.0-327.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/11/11+28]
2021.04.26 11:05:27 INFO es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/opt/sonarqube-8.4.1.35646/temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -Des.enforce.bootstrap.checks=true, -Xmx512m, -Xms512m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/sonarqube-8.4.1.35646/elasticsearch, -Des.path.conf=/opt/sonarqube-8.4.1.35646/temp/conf/es, -Des.distribution.flavor=default, -Des.distribution.type=tar]
2021.04.26 11:05:28 INFO es[][o.e.p.PluginsService] loaded module [analysis-common]
2021.04.26 11:05:28 INFO es[][o.e.p.PluginsService] loaded module [lang-painless]
2021.04.26 11:05:28 INFO es[][o.e.p.PluginsService] loaded module [mapper-extras]
2021.04.26 11:05:28 INFO es[][o.e.p.PluginsService] loaded module [parent-join]
2021.04.26 11:05:28 INFO es[][o.e.p.PluginsService] loaded module [percolator]
2021.04.26 11:05:28 INFO es[][o.e.p.PluginsService] loaded module [reindex]
2021.04.26 11:05:28 INFO es[][o.e.p.PluginsService] loaded module [repository-url]
2021.04.26 11:05:28 INFO es[][o.e.p.PluginsService] loaded module [transport-netty4]
2021.04.26 11:05:28 INFO es[][o.e.p.PluginsService] no plugins loaded
2021.04.26 11:05:29 WARN es[][o.e.d.c.s.Settings] [http.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.
2021.04.26 11:05:30 INFO es[][o.e.d.DiscoveryModule] using discovery type [zen] and host providers [settings]
2021.04.26 11:05:31 INFO es[][o.e.n.Node] initialized
2021.04.26 11:05:31 INFO es[][o.e.n.Node] starting ...
2021.04.26 11:05:31 INFO es[][o.e.t.TransportService] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2021.04.26 11:05:31 INFO es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2021.04.26 11:05:34 INFO es[][o.e.c.s.MasterService] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {sonarqube}{_Ewy-aLkTLKbdkGHHvPgBw}{v1qWPHlmSWOaAx5vLUjI2g}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}
2021.04.26 11:05:34 INFO es[][o.e.c.s.ClusterApplierService] new_master {sonarqube}{_Ewy-aLkTLKbdkGHHvPgBw}{v1qWPHlmSWOaAx5vLUjI2g}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}, reason: apply cluster state (from master [master {sonarqube}{_Ewy-aLkTLKbdkGHHvPgBw}{v1qWPHlmSWOaAx5vLUjI2g}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
2021.04.26 11:05:34 INFO es[][o.e.n.Node] started
2021.04.26 11:05:34 INFO es[][o.e.g.GatewayService] recovered [7] indices into cluster_state
2021.04.26 11:05:36 INFO es[][o.e.c.r.a.AllocationService] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[metadatas][0]] ...]).
2021.04.26 11:05:40 INFO es[][o.e.n.Node] stopping ...
2021.04.26 11:05:40 INFO es[][o.e.n.Node] stopped
2021.04.26 11:05:40 INFO es[][o.e.n.Node] closing ...
2021.04.26 11:05:40 INFO es[][o.e.n.Node] closed
搜索 es[][o.e.c.r.a.AllocationService] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[metadatas][0]] ...]).
说是内存不足
往前看 -Xmx512m, -Xms512m
有 /opt/sonarqube-8.4.1.35646/temp/conf/es 字样
里面的 jvm.options 这个文件写着
# This file has been automatically generated by SonarQube during startup.
# Please use sonar.search.javaOpts and/or sonar.search.javaAdditionalOpts in sonar.properties to specify jvm options for Elasticsearch
# DO NOT EDIT THIS FILE
修改 sonar 的 conf/sonar.properties
# JVM options of Elasticsearch process
sonar.search.javaOpts=-Xmx2G -Xms2G -XX:+HeapDumpOnOutOfMemoryError
依旧失败
看了下 logs/web.log 才发现真正的原因
2021.04.26 11:37:20 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed: Plugin PDF Report [pdfreport] requires at least SonarQube 8.7.0.41497
2021.04.26 11:37:20 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2021.04.26 11:37:20 INFO web[][o.s.p.ProcessEntryPoint] Hard stopping process