SonarQube가 실행될 때, 내부적으로 EleasticSearch를 사용하게 되는데,
root 계정으로는 EleasticSearch를 실행할 수 없어서 발생한 에러이다.
환경 구성
Ubuntu : 18.04
SonarQube : 8.9.10.x
결론 : 해결 방법
- sonarqube 실행할 새로운 사용자 생성
- 소유권 변경
- 권한 변경
- sonarqube 디렉터리 경로 변경
- 기존 경로 : /root/app/sonarqube[버전]
- 변경 경로: /opt/sonarqube
에러 로그 확인
로그 생성되는 경로
/root/app/sonarqube-8.9.10.61524/logs
2023.03.20 07:02:17 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release
uncaught exception in thread [main]
java.lang.RuntimeException: can not run elasticsearch as root
SonarQube 사용자 생성
sudo adduser sonar
sonarqube 디렉터리 소유자 변경
sudo chown -R sonar:sonar sonarqube-8.9.10.61524
su sonar로 사용자 변경 후 해당 경로에서./sonar.sh start 실행하면 다음과 같은 화면 조회됨
권한 변경
chmod 775 sonarqube-8.9.10.61524
같은 에러 발생하여 sonar.sh 106번 행 확인
에러 로그 재확인
org.elasticsearch.ElasticsearchException: java.lang.InterruptedException
2023.03.20 05:00:41 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /root/app/sonarqube-8.9.10.61524/temp
2023.03.20 05:00:41 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:44045]
2023.03.20 05:00:41 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/root/app/sonarqube-8.9.10.61524/elasticsearch]: /root/app/sonarqube-8.9.10.61524/elasticsearch/bin/elasticsearch
2023.03.20 05:00:41 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.03.20 05:00:44 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2023.03.20 05:00:44 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2023.03.20 05:00:44 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
2023.03.20 05:00:44 ERROR app[][o.s.a.p.EsManagedProcess] Failed to check status
org.elasticsearch.ElasticsearchException: java.lang.InterruptedException
at org.elasticsearch.client.RestHighLevelClient.performClientRequest(RestHighLevelClient.java:2695)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:2171)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:2137)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:2105)
at org.elasticsearch.client.ClusterClient.health(ClusterClient.java:151)
at org.sonar.application.es.EsConnectorImpl.getClusterHealthStatus(EsConnectorImpl.java:64)
at org.sonar.application.process.EsManagedProcess.checkStatus(EsManagedProcess.java:98)
at org.sonar.application.process.EsManagedProcess.checkOperational(EsManagedProcess.java:90)
at org.sonar.application.process.EsManagedProcess.isOperational(EsManagedProcess.java:68)
at org.sonar.application.process.ManagedProcessHandler.refreshState(ManagedProcessHandler.java:220)
at org.sonar.application.process.ManagedProcessHandler$EventWatcher.run(ManagedProcessHandler.java:285)
Caused by: java.lang.InterruptedException: null
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1343)
at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:243)
at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:75)
at org.elasticsearch.client.RestHighLevelClient.performClientRequest(RestHighLevelClient.java:2692)
... 10 common frames omitted
2023.03.20 06:16:48 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /root/app/sonarqube-8.9.10.61524/temp
2023.03.20 06:16:48 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:34635]
2023.03.20 06:16:48 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/root/app/sonarqube-8.9.10.61524/elasticsearch]: /root/app/sonarqube-8.9.10.61524/elasticsearch/bin/elasticsearch
2023.03.20 06:16:48 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.03.20 06:16:53 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2023.03.20 06:16:53 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2023.03.20 06:16:53 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
/opt/sonarqube 디렉터리를 만들고, sonarqube 디렉토리를 이동하여
해당 디렉터리에서 sonar 계정으로 실행하니 정상적으로 실행됨!
Ref.
728x90
'🏰 Back-end > Server' 카테고리의 다른 글
[Server] 배포 후 서버에서 websocket connection to failed (1) | 2023.03.12 |
---|---|
[Docker] Docker로 Redmine 구축하기(Ubuntu 18.04 / redmine 5.0.4 / mariaDB 10.5) (3) | 2023.01.19 |
[Linux]기초 명령어 정리 (1) | 2022.12.24 |
[Linux] NPM(Nginx Proxy Manager)설치 (0) | 2022.12.02 |
[Tomcat] xml 변경 시 톰캣을 재기동하는 이유 + 재기동 없이 적용하는 방법 (0) | 2022.12.02 |
댓글