Confluence 2.6 のサポートは終了しています。
ドキュメントの最新バージョンを確認してください。
はじめに
A new feature in Confluence 2.3 is the ability to configure and run multiple copies of Confluence in a cluster, so that clients can connect to any copy and see the same information. While we have tried to make clustering Confluence as easy and administrator-friendly as possible, it is a major architectural change and requires extra planning for deployment and upgrades.
This document will give a technical overview of clustering in Confluence 2.3, primarily for those users and developers who will be installing and configuring Confluence in a cluster. A separate overview is available for Confluence plugin developers.
Confluence cluster topology (simplified)
Cluster topology
A simple description of the cluster topology for Confluence would be multiple applications, shared data source. A cluster of Confluence consists of:
- multiple homogenous installations of Confluence (called nodes below)
- a Confluence home directory for each installation.
- a distributed Tangosol Coherence cache, which all nodes use via a multicast group (see networking summary below)
- a single database, which all nodes connect to
The user is responsible for configuring an appropriate HTTP load balancer in front of the clustered installations. Typically this means using mod_jk or another application server load-balancing technology. The load balancer must be configured to support session affinity.
Communication between clustered nodes is minimised by using a distributed cache which propagates updates to all other nodes automatically. Where necessary, Coherence provides a locking mechanism for synchronising jobs and a RMI interface for more complex communication.
LAN Clustering Only
Atlassian only supports clustering over a local area network. While it is theoretically possible to configure Massive to cluster across a WAN, the latency involved is likely to kill performance of the cluster. We can't stop you trying, of course, but you're going to have to work out how to configure Coherence yourself, and we're not going to support the resulting mess.
Homogenous Confluence installations
All the Confluence installations must be running exactly the same application, down to the lowest level. Items that must be the same include:
- Confluence バージョン
- Application server version
- JDK version
- Libraries and plugins in the Confluence classpath, WEB-INF/lib
- Libraries in the application server classpath
The installation section has more information how to ensure homogenous node installations.
Creating a Confluence cluster
When installing Confluence in a clustered setup, you will be responsible for configuring your web server and load balancer to distribute traffic between each node. No additional software is required as Coherence is bundled with Confluence.
Here is an overview of the process:
- Obtain a clustered licence key from Atlassian for each node
- Upgrade a single node to the clustered licence
- Start the cluster from that node's administration menu, specifying a name and optionally a preferred network interface
- Restart the single node and test it
- Copy the Confluence application and Confluence home directory to the second node
- Bring up the second node and it will automatically join the cluster.
Copying the Confluence application and home directory helps ensure that the installations are homogenous.
An alternative to this method is to copy the Confluence web application, but not the Confluence home directory. In this case, the installation wizard will require your cluster name to connect to the other nodes, and it will automatically configure itself. You will need to rebuild the index manually after this installation, however.
There is now full documentation for a Confluence cluster installation.
アップグレード方法
Another consequence of the homogenous requirement is that upgrades must be done by following a strict process.
- All cluster nodes are brought down
- Upgrade a single node to the latest Confluence version
- Start the single node so it can upgrade the database
- Upgrade subsequent nodes and start them one-by-one.
This is the only safe method of upgrading a Confluence cluster.
Single database
The Confluence database in a cluster is shared by all nodes. This means that the database must be able to scale to service all the Confluence nodes, which will probably mean implementing some kind of database cluster and JDBC-level load balancing. We can not offer support with scaling or tuning your database, you will need to talk to your DBA or database vendor.
For obvious reasons, you must have an external database to run Massive - you can not cluster Confluence when using the embedded HSQL database.
The most important requirement for the cluster database is that it have sufficient connections available to support the expected number of application nodes. For example, if each Confluence instance has a connection pool of 20 connections and you expect to run a cluster with four nodes, your database server must allow at least 80 connections to the Confluence database. In practice, you may require more than the minimum for debugging or administrative purposes.
In a cluster, attachments must be stored in the database. Configuring a cluster in an existing installation will automatically migrate your attachments to the database. Non-clustered installations still have the option of using the Confluence home directory for storing attachments.
While attachments are stored in the database, they are temporarily written to the cluster node's local filesystem, designated <confluence-home>/temp
folder, when being streamed to users (so Confluence doesn't have to hold open database connections unnecessarily). For this reason, Confluence will still need enough temporary disk space to hold any attachments currently in transit.
Distributed cache
In a normal configuration, Confluence uses many caches to reduce the number of database queries required for common operations. Viewing a page might require dozens of permissions checks, and it would be very slow if Confluence queried the database for this information with every page view. However, caches must be carefully maintained so they are consistent with the application data. If the page permissions change, the old invalid data needs to be removed from the cache so it can be replaced with a fresh correct copy.
To preserve consistent caches across a cluster, Confluence uses a distributed cache called Tangosol Coherence, which manages replicating cache updates transparently across all nodes. The network requirements of the distributed cache are quite simple, but must be preserved if the cluster is to work properly.
To discover other nodes in the cluster, Confluence broadcasts a join request on a multicast network address. Confluence must be able to open a UDP port on this multicast address, or it will not be able to find the other cluster nodes.
Once the nodes are discovered, each responds with a unicast (normal) IP address and port where it can be contacted for cache updates. Confluence must be able to open a UDP port for regular communication with the other nodes.
Because the Coherence network requirements are different to those required by the Confluence database connection, the situation can arise where Confluence can use the database but not talk to the other nodes in the cluster via Coherence. When Confluence detects this, it will shut itself down in a cluster panic.
For more details on the network configuration of the distributed cache, see the networking summary
Home directory
Confluence's home directory has a much-reduced role in a cluster. Because the application data must be shared between all nodes for consistency, the only information stored in the Confluence home directory is either node-specific, or needed to start Confluence. This includes information related to:
- database connection
- ライセンス
- cluster connection
The only application data stored in the Confluence home directory is the Lucene search index. Confluence synchronises this data itself by keeping track of indexing tasks in the database.
This is also why we recommend copying the Confluence home directory from the first node when setting up subsequent nodes. If you did not copy the Confluence home directory, you would need to rebuild the search index from scratch on the subsequent nodes after installation.
イベントのハンドリング
Broadcasting events to all nodes in a cluster is supported in Confluence, but not recommended. The cluster topology uses a shared data store so that application state does not need to be synchronised by events.
The event broadcasting is done only for certain events, like installing a plugin. When a plugin is installed in one node, Confluence puts the plugin data in the database, and notifies the other nodes that they need to load the plugin into memory.
インデックス作成
Confluence maintains a copy of its Lucene search index on each node of the cluster. This index is used for many things beside full-text searches, including RSS feeds and lists of recently updated content. If a node is disconnected from the cluster for a short amount of time (less than three hours), it will be able to bring its copy of the index up-to-date when it rejoins the cluster. If the node is down for longer than that, it will be forced to completely rebuild its search index from scratch.
If a node is down for a long amount of time and its lucene index has become stale as a result, you may want to avoid the expensive operation of rebuilding the index. To do that, you must copy a "live" version of the Lucene index from an active node. Simply replace the contents of the confluence home/index
directory with those from an active node before bringing the stale node back up.
Job synchronisation
For tasks such as sending the daily report emails, it is important that only one node in the cluster does this. Otherwise you would get multiple emails from Confluence every day.
Confluence uses locks in the Coherence distributed cache to ensure only one node can be running certain jobs at a time. This ensures email notifications will only be sent once.
Activity tracking
Activity tracking does not work in a cluster, and will be disabled for clustered deployments. We're working on making the activity tracker clusterable in a future release. You can follow this issue in JIRA: CONF-7520
Cluster panic
In some situations, there can be a network issue or firewall that prevents the distributed cache from communicating but still allows Confluence to update the database. This is a dangerous situation because when the caches on the detached nodes become inconsistent, users on different nodes will see different information and updates can be lost.
Confluence can detect this problem by checking a database value against a cached value, and if they differ, all the clustered nodes will be shut down with a 'Cluster panic' message. This is considered a fatal error because the consequences can cause damage to your data. For those administrators that like to live on the edge, there is a system property to prevent cluster panic and allow data corruption. For more information, see Cluster safety mechanism.
If a cluster panic does occur, you need to ensure proper network connectivity between the clustered nodes. Most likely multicast traffic is being blocked or not routed correctly. See the networking summary below.
Summary of network requirements
In addition to normal connectivity with its database, all clustered Confluence instances require access to a multicast group and the ability to open a UDP unicast port.
By default, the multicast address is automatically generated from the cluster name you provide when starting the cluster and the multicast port is fixed. During cluster setup, Confluence will prompt for the unicast IP address to use if the server has multiple network interfaces, and by default the unicast port is fixed. The cluster multicast group will be joined on the same network interface as the bound unicast IP address.
For any settings which are not configurable through the Confluence web interface, they can be configured via an XML file in the Confluence home directory for more exotic networking requirements.
Scaling Confluence On A Single Server
Since the maximum addressable memory on a 32 bit JVM is 4GB, some large servers may scale Java applications by running JVM instances concurrently. This would be implemented as separate, clustered Confluence nodes running on a single server and communicating internally. Because each JVM replicates the cache entirely, it may be useful to test a single, massive instance running a 64 bit JVM as an alternative. This configuration may result in superior performance than an internal cluster.
Geographically Distributed Clusters
Co-locating nodes is inadvisable as high latency may unacceptably degrade cache replication. Cluster nodes will provide the best performance if servers are physically adjacent. However, as long as all nodes share a LAN, users may wish to test alternative configurations to see how performance is affected.