Apache Solr Documentation

6.5 Ref Guide (PDF Download)
Solr Tutorial
Solr Community Wiki

Older Versions of this Guide (PDF)

Ref Guide Topics


*** As of June 2017, the latest Solr Ref Guide is located at https://lucene.apache.org/solr/guide ***

Please note comments on these pages have now been disabled for all users.

Skip to end of metadata
Go to start of metadata

The SolrCloud architecture is not particularly well suited for situations where a single SolrCloud cluster consists of nodes in separated data clusters connected by an expensive pipe. The root problem is that SolrCloud is designed to support Near Real Time Searching by immediately forwarding updates between nodes in the cluster on a per-shard basis. "CDCR" features exist to help mitigate the risk of an entire Data Center outage.

What is CDCR?

The goal of the project is to replicate data to multiple Data Centers. The initial version of the solution will cover the active-passive scenario where data updates are replicated from a Source Data Center to one or more Target Data Centers. The Target Data Center(s) will not propagate updates to the Source Data Center and updates should not be sent to any of the Target Data Center(s). Data updates include adds, updates and deletes. Source and Target Data Centers can serve search queries when CDCR is operating. The Target Data Centers will have slightly stale views of the corpus due to propagation delays, but this is  minimal (perhaps a few seconds).

Data changes on the Source Data Center are replicated to the Target Data Center only after they are persisted to disk. The data changes can be replicated in real-time (with a small delay) or could be scheduled to be sent in intervals to the Target Data Center. This solution pre-supposes that the Source and Target data centers begin with the same documents indexed. Of course the indexes may be empty to start.

Each shard leader in the Source Data Center will be responsible for replicating its updates to the corresponding leader in the Target Data Center. When receiving updates from the Source Data Center, shard leaders in the Target Data Center will replicate the changes to their own replicas.

This replication model is designed to tolerate some degradation in connectivity, accommodate limited bandwidth, and support batch updates to optimize communication. 

Replication supports both a new empty index and pre-built indexes. In the scenario where the replication is set up on a pre-built index, CDCR will ensure consistency of the replication of the updates, but cannot ensure consistency on the full index. Therefore any index created before CDCR was set up will have to be replicated by other means (described in the section Initial Startup) in order that Source and Target indexes be fully consistent.

The active-passive nature of the initial implementation implies a "push" model from the Source collection to the Target collection. Therefore, the Source configuration must be able to "see" the ZooKeeper ensemble in the Target cluster. The ZooKeeper ensemble is provided configured in the Source's solrconfig.xml file.

CDCR is configured to replicate from collections in the Source cluster to collections in the Target cluster on a collection-by-collection basis. Since CDCR is configured in solrconfig.xml (on both Source and Target clusters), the settings can be tailored for the needs of each collection. 

CDCR can be configured to replicate from one collection to a second collection within the same cluster. That is a specialized scenario not covered in this document.



Terms used in this document include:

  • Node: A JVM instance running Solr; a server.
  • Cluster: A set of Solr nodes managed as a single unit by a ZooKeeper ensemble, hosting one or more Collections.
  • Data Center: A group of networked servers hosting a Solr cluster. In this document, the terms Cluster and Data Center are interchangeable as we assume that each Solr cluster is hosted in a different group of networked servers.
  • Shard: A sub-index of a single logical collection. This may be spread across multiple nodes of the cluster. Each shard can have as many replicas as needed.
  • Leader: Each shard has one node identified as its leader. All the writes for documents belonging to a shard are routed through the leader.
  • Replica: A copy of a shard for use in failover or load balancing. Replicas comprising a shard can either be leaders or non-leaders.
  • Follower: A convenience term for a replica that is not the leader of a shard.
  • Collection: Multiple documents that make up one logical index. A cluster can have multiple collections.
  • Updates Log: An append-only log of write operations maintained by each node.


Here is a picture of the data flow.

Updates and deletes are first written to the Source cluster, then forwarded to the Target cluster. The data flow sequence is:

  1. A shard leader receives a new data update that is processed by its Update Processor.
  2. The data update is first applied to the local index.
  3. Upon successful application of the data update on the local index, the data update is added to the Updates Log queue.
  4. After the data update is persisted to disk, the data update is sent to the replicas within the Data Center.
  5. After Step 4 is successful CDCR reads the data update from the Updates Log and pushes it to the corresponding collection in the Target Data Center. This is necessary in order to ensure consistency between the Source and Target Data Centers.
  6. The leader on the Target data center writes the data locally and forwards it to all its followers.

Steps 1, 2, 3 and 4 are performed synchronously by SolrCloud; Step 5 is performed asynchronously by a background thread. Given that CDCR replication is performed asynchronously, it becomes possible to push batch updates in order to minimize network communication overhead. Also, if CDCR is unable to push the update at a given time -- for example, due to a degradation in connectivity -- it can retry later without any impact on the Source Data Center.

One implication of the architecture is that the leaders in the Source cluster must be able to "see" the leaders in the Target cluster. Since leaders may change, this effectively means that all nodes in the Source cluster must be able to "see" all Solr nodes in the Target cluster so firewalls, ACL rules, etc. must be configured with care.

The current design works most robustly if both the Source and Target clusters have the same number of shards. There is no requirement that the shards in the Source and Target collection have the same number of replicas.

Having different numbers of shards on the Source and Target cluster is possible, but is also an "expert" configuration as that option imposes certain constraints and is not recommended. Most of the scenarios where having differing numbers of shards are contemplated are better accomplished by hosting multiple shards on each Target Solr instance.

Major Components

There are a number of key features and components in CDCR’s architecture:

CDCR Configuration

In order to configure CDCR, the Source Data Center requires the host address of the ZooKeeper cluster associated with the Target Data Center. The ZooKeeper host address is the only information needed by CDCR to instantiate the communication with the Target Solr cluster. The CDCR configuration file on the Source cluster will therefore contain a list of ZooKeeper hosts. The CDCR configuration file might also contain secondary/optional configuration, such as the number of CDC Replicator threads, batch updates related settings, etc.

CDCR Initialization

CDCR supports incremental updates to either new or existing collections. CDCR may not be able to keep up with very high volume updates, especially if there are significant communications latencies due to a slow "pipe" between the data centers. Some scenarios:

  • There is an initial bulk load of a corpus followed by lower volume incremental updates. In this case, one can do the initial bulk load and then enable CDCR. See the section Initial Startup for more information.
  • The index is being built up from scratch, without a significant initial bulk load. CDCR can be set up on empty collections and keep them synchronized from the start.
  • The index is always being updated at a volume too high for CDCR to keep up. This is especially possible in situations where the connection between the Source and Target data centers is poor. This scenario is unsuitable for CDCR in its current form.

Inter-Data Center Communication

Communication between Data Centers will be achieved through HTTP and the Solr REST API using the SolrJ client. The SolrJ client will be instantiated with the ZooKeeper host of the Target Data Center. SolrJ will manage the shard leader discovery process.

Updates Tracking & Pushing

CDCR replicates data updates from the Source to the Target Data Center by leveraging the Updates Log.

A background thread regularly checks the Updates Log for new entries, and then forwards them to the Target Data Center. The thread therefore needs to keep a checkpoint in the form of a pointer to the last update successfully processed in the Updates Log. Upon acknowledgement from the Target Data Center that updates have been successfully processed, the Updates Log pointer is updated to reflect the current checkpoint.

This pointer must be synchronized across all the replicas. In the case where the leader goes down and a new leader is elected, the new leader will be able to resume replication from the last update by using this synchronized pointer. The strategy to synchronize such a pointer across replicas will be explained next.

If for some reason, the Target Data Center is offline or fails to process the updates, the thread will periodically try to contact the Target Data Center and push the updates.

Synchronization of Update Checkpoints

A reliable synchronization of the update checkpoints between the shard leader and shard replicas is critical to avoid introducing inconsistency between the Source and Target Data Centers. Another important requirement is that the synchronization must be performed with minimal network traffic to maximize scalability.

In order to achieve this, the strategy is to:

  • Uniquely identify each update operation. This unique identifier will serve as pointer.
  • Rely on two storages: an ephemeral storage on the Source shard leader, and a persistent storage on the Target cluster.

The shard leader in the Source cluster will be in charge of generating a unique identifier for each update operation, and will keep a copy of the identifier of the last processed updates in memory. The identifier will be sent to the Target cluster as part of the update request. On the Target Data Center side, the shard leader will receive the update request, store it along with the unique identifier in the Updates Log, and replicate it to the other shards.

SolrCloud is already providing a unique identifier for each update operation, i.e., a “version” number. This version number is generated using a time-based lmport clock which is incremented for each update operation sent. This provides an “happened-before” ordering of the update operations that will be leveraged in (1) the initialization of the update checkpoint on the Source cluster, and in (2) the maintenance strategy of the Updates Log.

The persistent storage on the Target cluster is used only during the election of a new shard leader on the Source cluster. If a shard leader goes down on the Source cluster and a new leader is elected, the new leader will contact the Target cluster to retrieve the last update checkpoint and instantiate its ephemeral pointer. On such a request, the Target cluster will retrieve the latest identifier received across all the shards, and send it back to the Source cluster. To retrieve the latest identifier, every shard leader will look up the identifier of the first entry in its Update Logs and send it back to a coordinator. The coordinator will have to select the highest among them.

This strategy does not require any additional network traffic and ensures reliable pointer synchronization. Consistency is principally achieved by leveraging SolrCloud. The update workflow of SolrCloud ensures that every update is applied to the leader but also to any of the replicas. If the leader goes down, a new leader is elected. During the leader election, a synchronization is performed between the new leader and the other replicas. As a result, this ensures that the new leader has a consistent Update Logs with the previous leader. Having a consistent Updates Log means that:

  • On the Source cluster, the update checkpoint can be reused by the new leader.
  • On the Target cluster, the update checkpoint will be consistent between the previous and new leader. This ensures the correctness of the update checkpoint sent by a newly elected leader from the Target cluster.

Maintenance of Updates Log

The CDCR replication logic requires modification to the maintenance logic of the Updates Log on the Source Data Center. Initially, the Updates Log acts as a fixed size queue, limited to 100 update entries. In the CDCR scenario, the Update Logs must act as a queue of variable size as they need to keep track of all the updates up through the last processed update by the Target Data Center. Entries in the Update Logs are removed only when all pointers (one pointer per Target Data Center) are after them.

 If the communication with one of the Target Data Center is slow, the Updates Log on the Source Data Center can grow to a substantial size. In such a scenario, it is necessary for the Updates Log to be able to efficiently find a given update operation given its identifier. Given that its identifier is an incremental number, it is possible to implement an efficient search strategy. Each transaction log file contains as part of its filename the version number of the first element. This is used to quickly traverse all the transaction log files and find the transaction log file containing one specific version number.


CDCR provides the following monitoring capabilities over the replication operations:

  • Monitoring of the outgoing and incoming replications, with information such as the Source and Target nodes, their status, etc.
  • Statistics about the replication, with information such as operations (add/delete) per second, number of documents in the queue, etc.

Information about the lifecycle and statistics will be provided on a per-shard basis by the CDC Replicator thread. The CDCR API can then aggregate this information an a collection level.

CDC Replicator

The CDC Replicator is a background thread that is responsible for replicating updates from a Source Data Center to one or more Target Data Centers. It will also be responsible in providing monitoring information on a per-shard basis. As there can be a large number of collections and shards in a cluster, we will use a  fixed-size pool of CDC Replicator threads that will be shared across shards.


The current design of CDCR has some limitations. CDCR will continue to evolve over time and many of these limitations will be addressed. Among them are:

  • CDCR is unlikely to be satisfactory for bulk-load situations where the update rate is high, especially if the bandwidth between the Source and Target clusters is restricted. In this scenario, the initial bulk load should be performed, the Source and Target data centers synchronized and CDCR be utilized for incremental updates.
  • CDCR is currently only active-passive; data is pushed from the Source cluster to the Target cluster. There is active work being done in this area in the 6x code line to remove this limitation.
  • CDCR works most robustly with the same number of shards in the Source and Target collection. The shards in the two collections may have different numbers of replicas.


The Source and Target configurations differ in the case of the data centers being in separate clusters. "Cluster" here means separate ZooKeeper ensembles controlling disjoint Solr instances. Whether these data centers are physically separated or not is immaterial for this discussion.

Source Configuration

Here is a sample of a Source configuration file, a section in solrconfig.xml. The presence of the <replica> section causes CDCR to use this cluster as the Source and should not be present in the Target collections in the cluster-to-cluster case. Details about each setting are after the two examples:

Target Configuration

Here is a typical Target configuration. 

Target instance must configure an update processor chain that is specific to CDCR. The update processor chain must include the CdcrUpdateProcessorFactory. The task of this processor is to ensure that the version numbers attached to update requests coming from a CDCR Source SolrCloud are reused and not overwritten by the Target. A properly configured Target configuration looks similar to this.

Configuration Details

The configuration details, defaults and options are as follows:

The Replica Element

CDCR can be configured to forward update requests to one or more replicas. A replica is defined with a “replica” list as follows:






The host address for ZooKeeper of the Target SolrCloud. Usually this is a comma-separated list of addresses to each node in the Target ZooKeeper ensemble. 



The name of the collection on the Source SolrCloud to be replicated.

TargetYesnoneThe name of the collection on the Target SolrCloud to which updates will be forwarded.

The Replicator Element

The CDC Replicator is the component in charge of forwarding updates to the replicas. The replicator will monitor the update logs of the Source collection and will forward any new updates to the Target collection. The replicator uses a fixed thread pool to forward updates to multiple replicas in parallel. If more than one replica is configured, one thread will forward a batch of updates from one replica at a time in a round-robin fashion. The replicator can be configured with a “replicator” list as follows:






The number of threads to use for forwarding updates. One thread per replica is recommended.

scheduleNo10The delay in milliseconds for the monitoring the update log(s).
batchSizeNo128The number of updates to send in one batch. The optimal size depends on the size of the documents. Large batches of large documents can increase your memory usage significantly.

The updateLogSynchronizer Element

Expert: Non-leader nodes need to synchronize their update logs with their leader node from time to time in order to clean deprecated transaction log files. By default, such a synchronization process is performed every minute. The schedule of the synchronization can be modified with a “updateLogSynchronizer” list as follows:





No60000The delay in milliseconds for synchronizing the updates log.

The Buffer Element

CDCR is configured by default to buffer any new incoming updates. When buffering updates, the updates log will store all the updates indefinitely. Replicas do not need to buffer updates, and it is recommended to disable buffer on the Target SolrCloud. The buffer can be disabled at startup with a “buffer” list and the parameter “defaultState” as follows:






NoenabledThe state of the buffer at startup.


The CDCR API is used to control and monitor the replication process. Control actions are performed at a collection level, i.e., by using the following base URL for API calls: http://<hostname>:<port>/solr/<collection>. Monitor actions are performed at a core level, i.e., by using the following base URL for API calls: http://<hostname>:<port>/solr/<collection>.

Currently, none of the CDCR API calls have parameters.

API Entry Points (Control)

collection/cdcr?action=STATUS: Returns the current state of CDCR.
collection/cdcr?action=START: Starts CDCR replication
collection/cdcr?action=STOP: Stops CDCR replication.
collection/cdcr?action=ENABLEBUFFER: Enables the buffering of updates.
collection/cdcr?action=DISABLEBUFFER: Disables the buffering of updates.

API Entry Points (Monitoring)

core/cdcr?action=QUEUES: Fetches statistics about the queue for each replica and about the update logs.
core/cdcr?action=OPS: Fetches statistics about the replication performance (operations per second) for each replica
core/cdcr?action=ERRORS: Fetches statistics and other information about replication errors for each replica.

Control Commands




Query Parameters: There are no parameters to this command.



Output Content

The current state of the CDCR, which includes the state of the replication process and the state of the buffer.



Input: There are no parameters to this command.





Query Parameters: There are no parameters to this command.



Output Content

The status of the process and an indication of whether the buffer is enabled



Input This command enables the buffer, there are no parameters.





Query Parameters: There are no parameters to this command



Output Content: The status of CDCR and an indication that the buffer is disabled.



Input: This command disables buffering

Output: The status of CDCR and an indication that the buffer is disabled.




Query Parameters: There are no parameters for this action



Output Content: Confirmation that CDCR is started and the status of buffering








Query Parameters: There are no parameters for this command.



Output Content: The status of CDCR, including the confirmation that CDCR is stopped





Monitoring commands




Query Parameters: There are no parameters for this command



Output Content

The output is composed of a list “queues” which contains a list of (ZooKeeper) Target hosts, themselves containing a list of Target collections. For each collection, the current size of the queue and the timestamp of the last update operation successfully processed is provided. The timestamp of the update operation is the original timestamp, i.e., the time this operation was processed on the Source SolrCloud. This allows an estimate the latency of the replication process.

The “queues” object also contains information about the updates log, such as the size (in bytes) of the updates log on disk (“tlogTotalSize”), the number of transaction log files (“tlogTotalCount”) and the status of the updates log synchronizer (“updateLogSynchronizer”).








Query Parameters: There are no parameters for this command.



Output Content: The output is composed of a list “operationsPerSecond” which contains a list of (ZooKeeper) Target hosts, themselves containing a list of Target collections. For each collection, the average number of processed operations per second since the start of the replication process is provided. The operations are further broken down into two groups: add and delete operations.







Query Parameters: There are no parameters for this command.



Output Content: The output is composed of a list “errors” which contains a list of (ZooKeeper) Target hosts, themselves containing a list of Target collections. For each collection, information about errors encountered during the replication is provided, such as the number of consecutive errors encountered by the replicator thread, the number of bad requests or internal errors since the start of the replication process, and a list of the last errors encountered ordered by timestamp.





Initial Startup

This is a general approach for initializing CDCR in a production environment based upon an approach taken by the initial working installation of CDCR and generously contributed to illustrate a "real world" scenario. NOTE: The configuration snippets below illustrate specific points of configuration.

  • Customer uses the CDCR approach to keep a remote DR instance available for production backup.  This is an active-passive solution.
  • Customer has 26 clouds with 200 million assets per cloud (15GB indexes).  Total document count is over 4.8 billion.
    • Source and Target clouds were synched in 2-3 hour maintenance windows to establish the base index for the Targets.
  • Tip: As usual, it is good to start small.  Sync a single cloud and monitor for a period of time before doing the others. You may need to adjust your settings several times before finding the right balance.
    • Before starting, stop or pause the indexers. This is best done during a small maintenance window.
    • Stop the SolrCloud instances at the Source
    • Include the cdcr request handler configuration in solrconfig.xml


    • Upload the modified solrconfig.xml to ZooKeeper on both Source and Target
    • Sync the index directories from the Source collection to Target collection across to the corresponding shard nodes.
      • Tip: rsync works well for this.

For example: if there are 2 shards on collection1 with 2 replicas for each shard, copy the corresponding index directories from














    • Start the ZooKeeper on the Target (DR) side
    • Start the SolrCloud on the Target (DR) side
    • Start the ZooKeeper on the Source side
    • Start the SolrCloud on the Source side. As a general rule, the Target (DR) side of the SolrCloud should be started before the Source side.
    • Activate the CDCR on Source instance using the CDCR API: http://host:port/solr/collection_name/cdcr?action=START


    • There is no need to run the /cdcr?action=START command on the Target
    • Disable the buffer on the Target


    • Renable indexing



  1. Network and disk space monitoring are essential.  Ensure that the system has plenty of available storage to queue up changes if there is a disconnect between the Source and Target.  A network outage between the two data centers can cause your disk usage to grow. 
    1. Tip: Set a monitor for your disks to send alerts when the disk gets over a certain percentage (eg. 70%)
    2. Tip: Run a test.  With moderate indexing, how long can the system queue changes before you run out of disk space? 
  2. Create a simple way to check the counts between the Source and the Target.
    1. Keep in mind that if indexing is running, the Source and Target may not match document for document.  Set an alert to fire if the difference is greater than some percentage of the overall cloud size.

ZooKeeper settings

  1. With CDCR, the Target ZooKeepers will have connections from the Target clouds and the Source clouds.  You may need to increase the maxClientCnxns setting in the zoo.cfg. 

Upgrading and Patching Production

  1. When rolling in upgrades to your indexer or application, you should shutdown the Source (production) and the Target (DR). Depending on your setup, you may want to pause/stop indexing.  Deploy the release or patch and renable indexing.  Then start the Target (DR).
    1. Tip: There is no need to reissue the DISABLEBUFFERS or START commands.  These are persisted.
    2. Tip: After starting the Target, run a simple test.  Add a test document to each of the Source clouds.  Then check for it on the Target. 



  • No labels


  1. Pinging Erick Erickson – one very important information missing from the page is on how to promote a passive cluster to an active one in case the previous active cluster goes down.

  2. Shalin Shekhar Mangar: I am not sure I entirely understand the question. Are you asking how to promote the target cluster instead of the source cluster as main cluster, in the scenario where the source cluster goes down ? 

    1. Yes, exactly. This will be a commonly asked question.

  3. Let's assume these scenarios where DC1 is the active DC  and DC2 is passive. 

    Scenario 1

    DC1 suffers a flood and completely dies. DC3 is going to be brought on-line. We'd want to make DC2 the active and DC3 the passive.

    In this scenario, it is just a question of making the the correct solrconfig changes and of following the instructions in the "initial startup" section to get DC2 and DC3 in sync.

     However, it is important to note the following potential issue: 

    If a passive DC, e.g., DC2, is configured at some point in time to become active, because the first DC, e.g., DC1, had a failure, then we cannot guarantee that DC2 will be in sync with DC1 and therefore it might miss some updates.
    DC1 could have received updates just before having a failure, and didn't had time to forward those updates to DC2. Therefore DC2 is in an incomplete state when brought up as active cluster. 

    Scenario 2

    DC1 suffers a 3 day power outage. During that time, DC2 should take over, i.e., get updates and searches, etc. The power is restored to DC1 and is becoming the active one again. How do we recover ?

    In this scenario, we have to sync up DC1 with the new updates received by DC2 before making him active again. The best would be to first sync up its index with DC2 (this can be performed manually or using CDCR), and the steps would be as follow:
    • configure DC1 as passive
    • let DC1 sync up its index with DC2
    • when DC1 is in sync with DC2, stop updates and wait to have flush the latest updates through the DCs
    • stop DC1 and DC2, configure DC1 as active, DC2 as passive
    • start up DC1, then DC2
    • resume updates flow
    But like in the first scenario, there will be the possibilities to miss some updates.

    Let me know if this is what you were looking for.

  4. Can this configuration be used as active/active nodes, for implementing a global federated search?  For instance if I had a query federator that could query each solr cloud data center and I was in Asia Pacific region it I could query the AP Solr instances and the America Solr instances and the query and results would not have to travel over the expensive pipe, it would come from the replica of the shard that is in the region where the query originated? 

    1. Exactly–the documentation talks about "active-passive" only in terms of the replication direction.  Is it "active-passive" in the sense that only one collection will drive the updates, or is it more like "active-standby" where the collection in the destination cloud is not searchable while it is being updated?

      1. The active DC currently accepts updates and passes them along to the passive cluster. Both can serve searches. The index/commit process on the passive cluster is the same as any other Solr cluster it's just the source of the updates is the active cluster.


  5. The docs say the STOP command is STOPPED but it should be STOP.

    1. This has been fixed, thank you.

  6. Is this document is applicable for the apache solr 4.10.3 ?  will it work in version 4.10.3?

    1. No, CDCR was only added in Solr 6.0.

      This online documentation applies only to the upcoming release of Solr; documentation for earlier releases is available from the archived PDF files found in the left-navigation column under "Older Versions of this Guide (PDF)".