Start and stop Bitbucket

This page describes the various ways you can start or stop Bitbucket Data Center and Server, depending on which method suits your needs.

Start Bitbucket during installation

The Bitbucket installer can automatically start Bitbucket. If you're not using the installer, use the instructions below that are appropriate for your needs to start Bitbucket.

On this page



Start/stop Bitbucket


To start/stop Bitbucket

Linux の場合

Change to your <Bitbucket Server installation directory>, then use the command that meets your needs:

bin/start-bitbucket.sh
bin/stop-bitbucket.sh


Windows の場合

For automated starting and stopping of Bitbucket Server on Windows, it should be installed as a service.

You can use start-bitbucket.bat for short term debugging, using Ctrl+C will safely shutdown the instance when it is no longer needed. 

To start/stop Bitbucket Server manually when running as a service on Windows

Start and stop the Bitbucket Server service from the services console, on Windows. Ensure you start both the AtlassianBitbucket and AtlassianBitbucketElasticsearch services.

For macOS

Use the app icons in the <Bitbucket Server installation directory>. These link to the start-bitbucket.sh and stop-bitbucket.sh scripts in <Bitbucket Server installation directory>/bin.

Which app icons?

Start and stop app icons:

Start Bitbucket Data Center

For Bitbucket Data Center, the remote Elasticsearch instance must be started separately. It is a requirement of the Bitbucket Data Center setup that you have only one remote Elasticsearch instance for your entire cluster, as described on Installing Bitbucket Data Center. To start (or restart) a remote Elasticsearch instance, see Elasticsearch documentation for specific instructions.


To start Bitbucket Data Center (does not start Bitbucket's bundled Elasticsearch instance)

  1. Change to your <Bitbucket Server installation directory>
  2. Run this command:

    start-bitbucket.sh --no-search


Start/stop Bitbucket when running as a service

On Windows and Linux systems you can choose to have Bitbucket

 installed as a service, and it will be started automatically when the system boots.


To start/stop Bitbucket manually when running as service:

Linux の場合

Manage the Bitbucket service with these commands:

# service atlbitbucket status 
# service atlbitbucket stop 
# service atlbitbucket start


If you installed Bitbucket as a systemd service (as explained in Run Bitbucket as a Linux service), use these commands instead:


# systemctl bitbucket status
# systemctl bitbucket stop
# systemctl bitbucket start

Start Bitbucket without starting bundled Elasticsearch

Why would I want to start Bitbucket without starting the bundled Elasticsearch?

You're running Bitbucket Data Center: It is a requirement of the Bitbucket Data Center setup that you have only one remote Elasticsearch instance for your cluster, as described on Installing Bitbucket Data Center.

You have a remote Elasticsearch instance (for whatever reason): When using a remote Elasticsearch instance, you have to start Bitbucket without starting the bundled Elasticsearch instance.

You can also refer to How to Install and configure a remote Elasticsearch instance.

You have a Docker deployment: We strongly recommend that you run Elasticsearch on a separate container. Otherwise, you won't be able to properly trigger a graceful shutdown.


To start Bitbucket without starting the bundled Elasticsearch instance

Linux の場合
start-bitbucket.sh --no-search


Windows の場合

start-bitbucket.bat /no-search

 

For Docker installations, use the -e ELASTICSEARCH_ENABLED=false parameter.  Learn more about deploying Bitbucket through Docker


Performing a graceful shutdown (Linux only)

You can send a SIGTERM signal to Bitbucket to trigger a graceful shutdown. This will give Bitbucket some time to complete any running tasks, in-flight GIT requests, and in-flight user requests before terminating. The bin/stop-bitbucket.sh script, service atlbitbucket stop command, and systemctl bitbucket stop command all use the SIGTERM signal to terminate Bitbucket

During a graceful shutdown:

  • Tomcat stops accepting new HTTP connections without interrupting active connections.
  • The SSH server stop accepting new SSH connections without interrupting active connections.
  • The job scheduler will not start any new jobs, but will not immediately cancel any running jobs.


The following configuration properties control how graceful shutdown works:

既定値説明
graceful.shutdown.timeout
30

The amount of time (in seconds) that Bitbucket should allocate before terminating all active HTTP requests, SSH requests, and running jobs.

server.shutdown
graceful

Sets whether Bitbucket should initiate a graceful shutdown first upon termination. If you want Bitbucket

to shut down immediately without waiting for any tasks to complete, set this to immediate.

In addition to these config properties, the BITBUCKET_SHUTDOWN_TIMEOUT environment variable controls when  Bitbucket terminates altogether. This environmental variable will override plugin.search.indexing.event.shutdown.timeout.

By default,  BITBUCKET_SHUTDOWN_TIMEOUT is set to 40. We recommend you keep this environmental variable at least 10 seconds longer than plugin.search.indexing.event.shutdown.timeout.

Gracefully shutting down Docker deployments

If Bitbucket and ElasticSearch are running in the same container, you won't be able to trigger a graceful shutdown properly. We strongly recommend that you run ElasticSearch on its own separate container.

If ElasticSearch is not running on the same container, you can trigger a graceful Bitbucket shutdown through docker stop. This command will send a SIGTERM signal to Bitbucket.

最終更新日 2022 年 7 月 25 日

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

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