How to update the ports used by the bundled Elasticsearch
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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.
*Except Fisheye and Crucible
Summary
The bundled Elasticsearch that comes with Bitbucket uses the following ports by default:
Port number | Purpose | Remarks |
---|---|---|
7992 (TCP) | Elasticsearch HTTP interface port | This port is primarily used to receive HTTP and REST API requests from Bitbucket Server. As requests to this port are being made from the same server, this port does not need to be accessible from outside. |
7993 (TCP) | Elasticsearch transport/node communication port | This port is used to connect Elasticsearch to a cluster and to enable node-to-node communication. This port cannot be blocked, as it will prevent Elasticsearch from starting - but this port does not need to be accessible from the outside, as the bundled Elasticsearch instance is not part of a cluster. |
Reference: Which ports does Bitbucket Server listen on, and what are they used for?
If the Elasticsearch port values need to be changed for any reason, the procedures under the Solution section below can be followed.
Warning
Please take that if the port values are changed, they will be overwritten and reset to the default values when Bitbucket is upgraded.
Any modifications to the ports will need to be re-applied after the upgrade.
For this reason, it is recommended to keep the default Elasticsearch port values.
Environment
This Knowledgebase article only applies to Bitbucket instances that use the bundled Elasticsearch.
Solution
- Create a back up of the
<Bitbucket home directory>/shared/search/elasticsearch.yml
file - Edit the
<Bitbucket home directory>/shared/search/elasticsearch.yml
file To change the HTTP interface port, change the value in the following line:
http.port: 7992
Changing the HTTP port would require the Elasticsearch URL to be updated with the new port value.
This can be done either through the UI in
Administration > Server settings > Search
> Elasticsearch URL or through the plugin.search.elasticsearch.baseurl configuration propertyTo change the transport/node communication port, change the value in the following line:
transport.tcp.port: 7993
- Save the file
- Restart Bitbucket