gpt4 book ai didi

postgresql - 使用 postgresql 配置 Sonarqube

转载 作者:行者123 更新时间:2023-11-29 12:34:52 36 4
gpt4 key购买 nike

我正在努力使用 postgresql 作为数据库来安装 sonarqube (v7.6)。我已按照 Sonar 网站的说明进行操作: 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 数据库工作正常。我认为我的错误很愚蠢,但我想不通。

谁能指出我的错误?

最佳答案

我终于在/opt/sonarqube/logs/web.log中找到了额外的错误日志

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

ALTER USER sonar SET search_path TO sonardb;

search_path 必须指向架构,而不是数据库。但默认模式是公共(public)的,因此在安装脚本中删除这一行应该可以完成这项工作。

关于postgresql - 使用 postgresql 配置 Sonarqube,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54645812/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com