公式ドキュメント

https://docs.sonarqube.org/latest/setup/upgrading/

Index再生成

1. SonarQubeを停止します。
2. Elasticsearchのデータディレクトリをバックアップします。
3. Elasticsearchのデータディレクトリを削除します。デフォルトの場合、Elasticsearchのデータディレクトリは `${SONARQUBE_HOME}/data/es`.
4. SonarQubeを再起動します。SonarQubeが起動すると、Elasticsearchの新しいインデックスが自動的に作成されます。

注意: インデックスを再構築すると、過去のSonarQubeの解析データが失われるため、注意して実行してください。また、再構築中はSonarQubeが使用できなくなる可能性があるため、作業中にはユーザーに影響がないようにする必要があります。

8.9 to 9.9

情報収集

https://community.sonarsource.com/t/insufficient-memory-and-cannot-create-worker-gc-thread/88600

https://github.com/GoogleCloudPlatform/pgadapter/issues/405

Ubntu&CentOS7&AmazonLinux2で起動しない

Ubuntu 16.04起動せず
Ubuntu 18.04(元16.04)起動せず
Ubuntu 20.04(元16.04)起動せず
Ubuntu 20.04(元16.04) パッケージUpdateDockerサービス起動失敗で詰みと思いきや再起動後にトライで成功。OSアップデートで3回再起動
Ubuntu 20.04起動する。docker-ceインストール

Ubuntu 20.04/AmazonLinux 2023では再現せず

sonarqube   | [0.086s][warning][os,thread] Failed to start thread "GC Thread#0" - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
sonarqube   | #
sonarqube   | # There is insufficient memory for the Java Runtime Environment to continue.
sonarqube   | # Cannot create worker GC thread. Out of system resources.
sonarqube   | # An error report file with more information is saved as:
sonarqube   | # /tmp/hs_err_pid1.log
sonarqube exited with code 1

[ec2-user@ip-172-31-2-208 ~]$ uname -a Linux ip-172-31-2-208.ap-northeast-1.compute.internal 5.10.173-154.642.amzn2.x86_64 #1 SMP Wed Mar 15 00:26:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

#

# There is insufficient memory for the Java Runtime Environment to continue.

# Cannot create worker GC thread. Out of system resources.

# Possible reasons:

# The system is out of physical RAM or swap space

# The process is running with CompressedOops enabled, and the Java Heap may be

blocking the growth of the native heap

# Possible solutions:

# Reduce memory load on the system

# Increase physical memory or swap space

# Check if swap backing store is full

# Decrease Java heap size (-Xmx/-Xms)

# Decrease number of Java threads

# Decrease Java thread stack sizes (-Xss)

# Set larger code cache with -XX:ReservedCodeCacheSize=

# JVM is running with Unscaled Compressed Oops mode in which the Java heap is

# placed in the first 4GB address space. The Java Heap base address is the

# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddres s

# to set the Java Heap base and to place the Java Heap above 4GB virtual add ress.

# This output file may be truncated or incomplete.

#

# Out of Memory Error (workerManager.hpp:87), pid=1, tid=1

#

# JRE version: (17.0.6+10) (build )

# Java VM: OpenJDK 64-Bit Server VM (17.0.6+10, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g 1 gc, linux-amd64)

JVMオプショントライしまくり

/opt/java/openjdk/bin/java -XX:CICompilerCount=2 -XX:-UseCompressedOops -Xss136k  -Xmx256m -Xms256m -jar lib/sonarqube.jar
圧縮Ops無効-XX:-UseCompressedOops状況かわらず
スタックサイズ縮小-Xss136k状況かわらず
コードキャッシュ増加-XX:ReservedCodeCacheSize=128状況かわらず

https://stackoverflow.com/questions/25682398/how-to-reduce-the-number-of-threads-used-by-the-jvm

-XX:+UseSerialGC起動せず
-XX:CICompilerCount=2状況かわらず
-XX:+ReduceSignalUsage状況かわらず
-XX:+DisableAttachMechanism状況かわらず

7.9 to 8.9

移行後プロジェクトが消える

仕事のやつで遭遇した困った問題。 一覧には出てこない。個別に指定すると出てくる。

indexの作り直しでうまく行くのかは試してないけど試して見る価値あり。

7.9のPostgres9.6で起動

ServerID 243B8A4D-AX0SEMDXHfZSM2p8OkQR

SAML 関連に値を入れる

downして、volumeのバックアップ取得

docker volume create --name sonarqube_sonarqube_data79
docker volume create --name sonarqube_sonarqube_extensions79
docker volume create --name sonarqube_postgres_data79
docker volume create --name sonarqube_postgres79
docker container run --rm -it -v sonarqube_sonarqube_extensions:/from -v sonarqube_sonarqube_extensions79:/to alpine ash -c "cd /from ; cp -av . /to"
docker container run --rm -it -v sonarqube_sonarqube_data:/from -v sonarqube_sonarqube_data79:/to alpine ash -c "cd /from ; cp -av . /to"
docker container run --rm -it -v sonarqube_postgresql_data:/from -v sonarqube_postgres_data79:/to alpine ash -c "cd /from ; cp -av . /to"
docker container run --rm -it -v sonarqube_postgresql:/from -v sonarqube_postgres79:/to alpine ash -c "cd /from ; cp -av . /to"

この時点で付け替えしてみて起動することを確認する

ServerID 243B8A4D-AX0RveuJOTnufm9wIf7w

超重要!!プラグインのあるVolumeを消す!

間違えないように注意!

sonarqube7.9のdockerをrm
extentionsのvolumeをrm
dataのvolumeをrm

8.9にして起動する

ServerID 243B8A4D-AX0SEMDXHfZSM2p8OkQR

8.9から戻し。

sonarqube_dataが共有だったせいかエラーで起動せず。 docker-compose downしなかったので、DBが戻らず起動せず。

downしてps -aででてこない状態を確認して戻せば切り戻し成功!

DBだけ戻す方法(成功バージョン)

  1. docker-compose stop sonarqube
  2. DBをdump
  3. DBをクリアする
  4. dumpを投入
  5. docker-compose up sonarqube

DBの差し替え

  1. postgres9.6 & 13を準備
  2. 13にimport
  3. docker-compose stop sonarqube
  4. 13に切り替え。接続文字列変わる
  5. docker-compose up sonarqube
  6. プロジェクト引き継ぎ成功
  7. Server ID 243B8A4D-AX0SEMDXHfZSM2p8OkQR

9.6でexport

docker-compose exec db /bin/bash
pg_dumpall -U sonar > /var/tmp/backup.sql
exit
sudo docker cp `sudo docker-compose ps -q db`:/var/tmp/backup.sql ./
SonarQube ID information
Server ID: 243B8A4D-AX3X9bKMqyoRPKdD1a_m
Version: 7.9.6.41879
Date: 2022-01-06

13.6にimport

sudo docker cp backup.sql `sudo docker-compose ps -q db`:/var/tmp/backup.sql 
psql -U sonar < /var/tmp/backup.sql
exit
SonarQube ID information
Server ID: BCE753A0-AX3X9bKMqyoRPKdD1a_m
Version: 7.9.6.41879
Date: 2022-01-06
SonarQube ID information
Server ID: 243B8A4D-AX3X9bKMqyoRPKdD1a_m
Version: 7.9.6.41879
Date: 2022-01-06

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-05-11 (木) 09:37:04