用PostgreSQL配置Sonarqube

时间:2019-02-12 08:33:01

标签: postgresql sonarqube

我正在努力使用Postgresql作为数据库安装声纳(v7.6)。 我遵循了声纳网站的指示: https://docs.sonarqube.org/latest/setup/install-server/

但是我迷上了这个模糊的错误:

sh /opt/sonarqube/bin/linux-x86-64/sonar.sh console
Running SonarQube...
wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM...
jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
jvm 1 | 
jvm 1 | 2019.02.12 07:18:55 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
jvm 1 | 2019.02.12 07:18:55 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
jvm 1 | 2019.02.12 07:18:55 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es
jvm 1 | 2019.02.12 07:18:56 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
jvm 1 | 2019.02.12 07:18:56 INFO app[][o.e.p.PluginsService] no modules loaded
jvm 1 | 2019.02.12 07:18:56 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
jvm 1 | 2019.02.12 07:19:10 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
jvm 1 | 2019.02.12 07:19:10 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process7062216312618470165properties
jvm 1 | 2019.02.12 07:19:19 INFO app[][o.s.a.SchedulerImpl] Process [web] is stopped
jvm 1 | 2019.02.12 07:19:19 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped
jvm 1 | 2019.02.12 07:19:19 WARN app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 143
jvm 1 | 2019.02.12 07:19:19 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
wrapper | <-- Wrapper Stopped

这是我的安装过程:

# System config :
sysctl -w vm.max_map_count=262144
ulimit -n 65536

# Postgresql install (v9.6.10)
apt-get install -y postgresql
su - postgres
psql
CREATE USER sonar ;
ALTER USER sonar WITH PASSWORD 'PASSWORD';
CREATE DATABASE sonardb WITH ENCODING 'UTF8';
ALTER DATABASE sonardb OWNER TO sonar;
ALTER USER sonar SET search_path TO sonardb;

# Sonar install
apt-get install -y unzip
wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.6.zip
unzip sonarqube-7.6.zip
mv sonarqube-7.6 /opt/sonarqube

# Add sonar user
adduser sonar
chown -R sonar /opt/sonarqube

最后在/opt/sonarqube/conf/sonar.properties中添加postgresql conf:

sonar.jdbc.username=sonar
sonar.jdbc.password=PASSWORD
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonardb

我尝试了很多不同的设置。但是我总是以同样的错误结束。我认为问题来自我的postgresql设置,因为默认的H2数据库工作正常。 我认为我的错误很愚蠢,但我无法弄清楚。

有人可以指出我的错误吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

我终于在/opt/sonarqube/logs/web.log中找到了其他错误日志

问题是我混合了postgresql的“数据库”和“模式”:

UrlMatcher

search_path必须指向架构,而不是数据库。但是默认模式是公共模式,因此在安装脚本中删除此行即可完成工作。