Unable to access JMX monitoring via Jconsole when Bitbucket Server is hosted in AWS

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

問題

Unable to access JMX counters when Bitbucket Server is hosted in an Amazon EC2 instance which is part of a VPC.

Specifically jconsole says the connection to the remote JMX fails. 

診断

環境

  • Amazon EC2
  • VPC using a Security Group with restrictive rules

Diagnostic Steps

  • Verify that the JMX port you specified is open and listening
  • Run jconsole with debug logging enabled for more data on the issue:
jconsole -J -Djava.util.logging.config.file=path_to_logging.properties_for_jconsole

You should see something similar to the following in the jconsole debug output:

May 02, 2017 10:09:51 AM RMIConnector connect
FINER: [javax.management.remote.rmi.RMIConnector: rmiServer=Proxy[RMIServer,RemoteObjectInvocationHandler[UnicastRef [liveRef: [endpoint:[52.XX.XXX.XXX:33920](remote),objID:[-6cdfb6b5:15bc6963763:-7fff, 2103495553046990789]]]]]] failed to connect: java.rmi.ConnectException: Connection refused to host: 52.XX.XXX.XXX; nested exception is: 
java.net.ConnectException: Operation timed out (Connection timed out)

原因

JMX uses 2 ports, the one specified in the setenv.sh file and a port that is randomly assigned. In environments where access to ports is restricted, binding to the randomly assigned port may be prevented.

ソリューション

Set RMI port to the same JMX port specified in the setenv file by adding the following to the JVM_SUPPORT_RECOMMENDED_ARG configuration of the setenv file:

JVM_SUPPORT_RECOMMENDED_ARG="-Dcom.sun.management.jmxremote.rmi.port=3333"

Bitbucket Server 5.0+ では setenv と環境変数に変更があります

Bitbucket Server 5.0 以降では setenv.shsetenv.bat が取り除かれています。これらのファイルで設定されていたオプションは、環境変数で設定できるようになりました。環境変数の設定場所は、実行先のオペレーティング システムに応じます。

Linux

When using the atlbitbucket service on Linux, the environment variables are ignored. You must set the parameters in _start-webapp.sh (or start-bitbucket.sh). These values will be read when the service starts.

たとえば、 JVM_SUPPORT_RECOMMENDED_ARGS を設定するには、ファイルに次の行を追加します。

JVM_SUPPORT_RECOMMENDED_ARGS=-XX:+HeapDumpOnOutOfMemoryError

Windows

Bitbucket Server を実行しているユーザーで、パラメーターを環境変数として設定します。たとえば、JVM_SUPPORT_RECOMMENDED_ARGS を設定したい場合、それを環境変数として作成して適切な値を割り当てます。Bitbucket Server がスタートアップ スクリプトやサービスを利用して起動する際に、この値が取得および適用されます。

最終更新日 2017 年 5 月 4 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.