由于工作需要,需要将现有的jira单机版改为集群版
Here are some ways to set up a Jira cluster using the Apache httpd
server as the reverse proxy and load balancer. Also refer to Integrating Jira with Apache for a more general discussion of using Jira with Apache.
There are many load balancing and front end proxy solutions available that may suit your particular needs as well as or better than Apache httpd.
High level guide
- Install and configure the latest Jira as normal, ie. without the cluster-specific settings mentioned further below. 1. Startup this instance and load it with your Jira test plan data. 2. Shutdown this instance.
- Install a second node without launching it yet.
- Set the cluster settings on both instances as mentioned below:
- Point to the same database(the dbconfig.xml files on each should probably be identical) and an empty shared home.
- Create the cluster.properties file for each node
- Copy the following directories from the local home of the first node to the shared home (some may be empty) :
- data
- plugins
- logos
- import
- export
- Start the already-configured instance.
- Install your plugin and add the license if needed.
- Start the second instance. It will attach itself to the DB, and then fill in its local home and attach itself to the shared home. It will also then copy across your plugin.
For the clustering general release we aim to have the ability to add/update a plugin on a live cluster. This is not available yet for plugins that require upgrade tasks.
Each node on a separate machine
Each Jira node (two in this example) runs on its own machine (physical or virtual), with a third machine for the shared services. In production, the shared services will most likely run on separate machines from each other.
Jira setup
- On the third machine, set up a shared home directory that is writable by both servers.
- Set up the two Jira servers on different machines. These servers should:
- Have a
cluster.properties
in the local Jira home directory (see example below). - Be configured to use the same context path.
- Be configured to use the same database. The
dbconfig.xml
files on each should probably be identical. - Have their Apache node name set, by appending the following setting to the same variable (replacing
node1
with the node name used in the Apache load balancer configuration):-DjvmRoute=node1
- Have a
- Ensure the Base URL configured in Jira is the URL of the front end proxy / load balancer.
Example cluster.properties file
# This unique ID must match the username and the BalancerMember entry in the Apache config jira.node.id = node1 # The location of the shared home directory for all Jira nodes jira.shared.home = /net/mynfsserver/jira_shared_home
httpd configuration (no context path)
We need to configure httpd
similarly to a standard reverse proxy, but with the addition of the mod_proxy_balancer
configuration.
To run Jira at http://MyCompanyServer/
, add a configuration block similar to this at the end of http.conf.
<VirtualHost *:80> ProxyRequests off ServerName MyCompanyServer <Proxy balancer://jiracluster> # Jira node 1 BalancerMember http://jira1.internal.atlassian.com:8080 route=node1 # Jira node 2 BalancerMember http://jira2.internal.atlassian.com:8080 route=node2 # Security "we aren't blocking anyone but this the place to make those changes Order Deny,Allow Deny from none Allow from all # Load Balancer Settings # We are not really balancing anything in this setup, but need to configure this ProxySet lbmethod=byrequests ProxySet stickysession=JSESSIONID </Proxy> # Here's how to enable the load balancer's management UI if desired <Location /balancer-manager> SetHandler balancer-manager # You SHOULD CHANGE THIS to only allow trusted ips to use the manager Order deny,allow Allow from all </Location> # Don't reverse-proxy requests to the management UI ProxyPass /balancer-manager ! # Reverse proxy all other requests to the Jira cluster ProxyPass / balancer://jiracluster/ ProxyPreserveHost on </VirtualHost>
httpd configuration (with a context path)
Some slight changes to the above configuration are required if Jira is deployed under a context path. To run Jira at http://MyCompanyServer/jira/
, add a configuration block similar to this at the end of http.conf.
<VirtualHost *:80> ProxyRequests off ServerName MyCompanyServer <Proxy balancer://jiracluster> # Jira node 1 BalancerMember http://jira1.internal.atlassian.com:8080/jira route=node1 # Jira node 2 BalancerMember http://jira2.internal.atlassian.com:8080/jira route=node2 # Security "we aren't blocking anyone but this the place to make those changes Order Deny,Allow Deny from none Allow from all # Load Balancer Settings # We are not really balancing anything in this setup, but need to configure this ProxySet lbmethod=byrequests ProxySet stickysession=JSESSIONID </Proxy> # Here's how to enable the load balancer's management UI if desired <Location /balancer-manager> SetHandler balancer-manager # You SHOULD CHANGE THIS to only allow trusted ips to use the manager Order deny,allow Allow from all </Location> # Immediately redirect /jira to /jira/ and don't pass it to the load balancer. RedirectMatch ^/jira$ /jira/ ProxyPassMatch ^/jira$ ! # Don't reverse-proxy requests to the management UI ProxyPass /balancer-manager ! # Reverse proxy all other requests to the Jira cluster ProxyPass /jira balancer://jiracluster ProxyPreserveHost on </VirtualHost>
额外提一句,我之前的那个破解插件也是可以用的,只是在破解时要加上-d参数,代表是data center模式,破解完进入后部分插件也是要重新破解的
参考:https://developer.atlassian.com/server/jira/platform/configuring-a-jira-cluster/