Why is Bitbucket Server listening on random ports?

お困りですか?

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

コミュニティに質問

プラットフォームについて: 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 は除く

質問

You are noticing that Bitbucket is choosing two random ports to listen to on start-up, and are looking to gain information on what these ports are being used for, and if they can be configured to be set to a static value.

回答

By default Bitbucket Server and Bitbucket Data Center opens two random ports for the following Git operations:

  • Git transcoding, which helps deal with non-UTF-8 data in Git repositories
  • Git hook callbacks into Bitbucket Server/Bitbucket Data Center

For this reason, these ports cannot be disabled. However, you can change the behavior from just choosing a random port to instead having them listen on a consistent port of your choosing.

This can be done by adding the following configuration values into your $BITBUCKET_HOME/shared/bitbucket.properties file, and making sure to replace 0 with the ports of your choice:

hook.callback.socket.port=0
plugin.bitbucket-git.transcode.socket.port=0

(For Stash, the transcode property is plugin.stash-scm-git.transcode.socket.port=0. If this is configured, it will automatically be rewritten for Bitbucket Server upon upgrading to any 4.x version.)

If the configured value is negative or zero (the default), a random port is used. Otherwise, the specific port is used.

Once this configuration has been made, the ports for these two services should listen on the ports you specify the next time that Bitbucket is restarted.

The ports chosen should generally be 1024 or higher, since low range ports typically require root access and Bitbucket Server/Stash should not be run as root.

Last modified on Mar 18, 2019

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

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