Adding cluster nodes to Stash Data Center

This page...

... describes how to add another cluster node to an existing instance of Stash Data Center.

If you are moving to Stash Data Center...

... go straight to Installing Stash Data Center, instead.

If you are new to Stash Data Center...

... we suggest you take a look at Clustering with Stash Data Center.

Provisioning a cluster node

You can rapidly scale the capacity of Stash Data Center, with very little downtime, by provisioning extra cluster nodes.

We highly recommend provisioning cluster nodes using an automated configuration management tool such as Chef, Puppet, or Vagrant, or by spinning up identical virtual machine snapshots. 

The Stash cluster nodes all run the Stash Data Center web application:

  • Each Stash cluster node must be a dedicated machine.
  • The machines may be physical or virtual. 
  • The cluster nodes must be connected in a high speed LAN (that is, they must be physically in the same data center). 
  • The usual Stash supported platforms requirements, including those for Java and Git, apply to each cluster node.
  • The cluster nodes do not all need to be absolutely identical, but for consistent performance we recommend they should be as similar as possible.
  • All cluster nodes must run the same version of Stash Data Center.
  • All cluster nodes must have synchronized clocks (for example, using NTP) and be configured with the identical timezone.

Provisioning a cluster node involves the following steps:

1. Mount the shared home directory on the node

The Stash Data Center makes use of a shared file system that lives on a dedicated machine and is accessible using NFS. See Installing Stash Data Center for more information.

Mount the shared home directory as ${STASH_HOME}/shared. For example, suppose your Stash home directory is /var/atlassian/application-data/stash, and your shared home directory is available as an NFS export called stash-san:/stash-shared. Add the following line to /etc/fstab on the cluster node:

/etc/fstab
stash-san:/stash-shared /var/atlassian/application-data/stash/shared nfs nfsvers=3,lookupcache=pos,noatime,intr,rsize=32768,wsize=32768 0 0

Then mount it:

mkdir -p /var/atlassian/application-data/stash/shared
sudo mount -a

 

2. Install Stash Data Center on the node

Download the latest Stash Data Center distribution from https://www.atlassian.com/software/stash/download, and install Stash as normal on the cluster node. See Getting started.

3. Add the node to the cluster

Start Stash on the new node. See Starting and stopping Stash. You can optionally give the node a persistent, human readable name by setting a node.name system property under JVM_SUPPORT_RECOMMENDED_ARGS in setenv.sh. For example:

-Dcluster.node.name=stash-1

Once Stash has started, go to http://<load-balancer>/admin/clustering. You should see the new node listed, similarly to this:

Verify that the new node you have started up has successfully joined the cluster. If it does not, please check your network configuration and the ${STASH_HOME}/log/atlassian-stash.log files on all nodes. If you are unable to find a reason for the node failing to join successfully, please contact Atlassian Support.

4. Connect the node to the load balancer

The Stash Data Center makes use of a load balancer to distribute requests from your users to the cluster nodes. If a cluster node goes down, the load balancer immediately detects the failure and automatically directs requests to the other nodes within seconds. See Installing Stash Data Center for more information.

If you are using a hardware or software load balancer other than HAProxy, consult your vendor's documentation on how to add the new Stash cluster node to the load balancer.

If you are using HAProxy, simply add the following lines to your haproxy.cfg file:

# In the backend stash_http_backend section, add:
server stash<xx> 192.168.0.<x>:7990 check inter 10000 rise 2 fall 5

 

# In the backend stash_ssh_backend section, add:
server stash<xx> 192.168.0.<x>:7999 check port 7999

where the values for <x> and <xx> don't conflict with an existing node.

Now restart HAProxy: 

sudo service haproxy restart


Verify that the new node is in the cluster and receiving requests by checking the logs on each node to ensure that all are receiving traffic. Also check that updates done on one node are visible on the other nodes. 

You can monitor the health of your cluster by navigating to HAProxy's statistics page at http://<load-balancer>:8090/. You should see a page similar to this:


 

For any issues please raise a support ticket and mention that you are following the 'Adding cluster nodes to Stash Data Center' page.

Redirection notice

This page will redirect to /display/BitbucketServer/Adding+cluster+nodes+to+Bitbucket+Data+Center .

This page...

... describes how to add another cluster node to an existing instance of Stash Data Center.

If you are moving to Stash Data Center...

... go straight to Installing Stash Data Center, instead.

If you are new to Stash Data Center...

... we suggest you take a look at Clustering with Stash Data Center.

Provisioning a cluster node

You can rapidly scale the capacity of Stash Data Center, with very little downtime, by provisioning extra cluster nodes.

We highly recommend provisioning cluster nodes using an automated configuration management tool such as Chef, Puppet, or Vagrant, or by spinning up identical virtual machine snapshots. 

The Stash cluster nodes all run the Stash Data Center web application:

  • Each Stash cluster node must be a dedicated machine.
  • The machines may be physical or virtual. 
  • The cluster nodes must be connected in a high speed LAN (that is, they must be physically in the same data center). 
  • The usual Stash supported platforms requirements, including those for Java and Git, apply to each cluster node.
  • The cluster nodes do not all need to be absolutely identical, but for consistent performance we recommend they should be as similar as possible.
  • All cluster nodes must run the same version of Stash Data Center.
  • All cluster nodes must have synchronized clocks (for example, using NTP) and be configured with the identical timezone.

Provisioning a cluster node involves the following steps:

1. Mount the shared home directory on the node

The Stash Data Center makes use of a shared file system that lives on a dedicated machine and is accessible using NFS. See Installing Stash Data Center for more information.

Mount the shared home directory as ${STASH_HOME}/shared. For example, suppose your Stash home directory is /var/atlassian/application-data/stash, and your shared home directory is available as an NFS export called stash-san:/stash-shared. Add the following line to /etc/fstab on the cluster node:

/etc/fstab
stash-san:/stash-shared /var/atlassian/application-data/stash/shared nfs nfsvers=3,lookupcache=pos,noatime,intr,rsize=32768,wsize=32768 0 0

Then mount it:

mkdir -p /var/atlassian/application-data/stash/shared
sudo mount -a

 

2. Install Stash Data Center on the node

Download the latest Stash Data Center distribution from https://www.atlassian.com/software/stash/download, and install Stash as normal on the cluster node. See Getting started.

3. Add the node to the cluster

Start Stash on the new node. See Starting and stopping Stash. You can optionally give the node a persistent, human readable name by setting a node.name system property under JVM_SUPPORT_RECOMMENDED_ARGS in setenv.sh. For example:

-Dcluster.node.name=stash-1

Once Stash has started, go to http://<load-balancer>/admin/clustering. You should see the new node listed, similarly to this:

Verify that the new node you have started up has successfully joined the cluster. If it does not, please check your network configuration and the ${STASH_HOME}/log/atlassian-stash.log files on all nodes. If you are unable to find a reason for the node failing to join successfully, please contact Atlassian Support.

4. Connect the node to the load balancer

The Stash Data Center makes use of a load balancer to distribute requests from your users to the cluster nodes. If a cluster node goes down, the load balancer immediately detects the failure and automatically directs requests to the other nodes within seconds. See Installing Stash Data Center for more information.

If you are using a hardware or software load balancer other than HAProxy, consult your vendor's documentation on how to add the new Stash cluster node to the load balancer.

If you are using HAProxy, simply add the following lines to your haproxy.cfg file:

# In the backend stash_http_backend section, add:
server stash<xx> 192.168.0.<x>:7990 check inter 10000 rise 2 fall 5

 

# In the backend stash_ssh_backend section, add:
server stash<xx> 192.168.0.<x>:7999 check port 7999

where the values for <x> and <xx> don't conflict with an existing node.

Now restart HAProxy: 

sudo service haproxy restart


Verify that the new node is in the cluster and receiving requests by checking the logs on each node to ensure that all are receiving traffic. Also check that updates done on one node are visible on the other nodes. 

You can monitor the health of your cluster by navigating to HAProxy's statistics page at http://<load-balancer>:8090/. You should see a page similar to this:


 

For any issues please raise a support ticket and mention that you are following the 'Adding cluster nodes to Stash Data Center' page.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport