How to set up NGINX Plus as the load balancer for a JIRA Data Center cluster

The content on this page relates to platforms which are not supported for JIRA Applications. Consequently, Atlassian cannot guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.

This configuration only works with NGINX Plus, the paid version of NGINX. The free version does not support cookie-based session-affinity.

Description

JIRA Data Center needs a load balancer to run in front of it to distribute the incoming requests between each node. The load balancer must support cookie-based session-affinity. NGINX Plus can be set up to provide this for JIRA Data Center, using a configuration similar to the one below. You still need to follow the full installation guide available at Installing JIRA Data Center. For more details on the configuration of a load balancer in NGINX Plus, see the page Application Load Balancing with NGINX Plus and the Upstream module documentation, on the NGINX website.

Sample NGINX Configuration

The load balancer configuration below was taken directly from NGINX's documentation Application Load Balancing with NGINX Plus.

pid /var/run/nginx.pid;

events {}

http {
    # Search the cookie named JSESSIONID for data after the final ‘.’, and store that 
    # in a variable named $route_cookie
    map $cookie_jsessionid $route_cookie {
        ~.+\.(?P<route>\w+)$ $route;
    }

    # Search the URL for a trailing jsessionid parameter, and store the value after the final ‘.’ 
    # in a variable named $route_uri
    map $request_uri $route_uri {
        ~jsessionid=.+\.(?P<route>\w+)$ $route;
    }

    upstream jiracluster {
        server jira1.internal.atlassian.com:8080 route=node1;
        server jira2.internal.atlassian.com:8080 route=node2;
        sticky route $route_cookie $route_uri;
    }

    server {
        listen 80;
        server_name MyCompanyServer;
        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_pass http://jiracluster;
        }

        error_log /var/log/nginx/error.log;
        access_log /var/log/nginx/access.log;
    }
}
Last modified on Feb 19, 2016

Was this helpful?

Yes
No
Provide feedback about this article

Not finding the help you need?

Ask the community

Powered by Confluence and Scroll Viewport.