Migrating Solr Replicas

When you replace a host, migrating replicas on that host to the new host, instead of depending on failure recovery, can help ensure optimal performance.

Where possible, the Solr service routes requests to the proper host. Both ADDREPLICA and DELETEREPLICA calls
can be sent to any host in the cluster.

For adding replicas, the node parameter ensures the new replica is created on the intended host. If no host is specified, Solr selects a host with
relatively fewer replicas.

For deleting replicas, the request is routed to the host that hosts the replica to be deleted.

Adding replicas can be resource intensive. For best results, add replicas when the system is not under heavy load. For example, do not add additional replicas when heavy indexing is
occurring or when MapReduceIndexerTool jobs are running.

Cloudera recommends using API calls to create and unload cores. Do not use the Cloudera Manager Admin Console or the Solr Admin UI for these tasks.

This procedure uses the following names:

Host names:

origin at the IP address 192.168.1.81:8983_solr.

destination at the IP address 192.168.1.82:8983_solr.

Collection name email

Replicas:

The original replica email_shard1_replica1, which is on origin.

The new replica email_shard1_replica2, which will be on destination.

To migrate a replica to a new host

(Optional) If you want to add a replica to a particular node, review the contents of the live_nodes directory on ZooKeeper to find all nodes available to
host replicas. Open the Solr Administration User interface, click Cloud, click Tree, and expand live_nodes. The Solr Administration User Interface, including live_nodes, might appear as follows:

Note: Information about Solr nodes can also be found in clusterstate.json, but that file only lists nodes currently
hosting replicas. Nodes running Solr but not currently hosting replicas are not listed in clusterstate.json.

Verify that the replica creation succeeds and moves from recovery state to ACTIVE. You can check the replica status in the Cloud view, which can be
found at a URL similar to: http://192.168.1.82:8983/solr/#/~cloud.
Note: Do not delete the original replica until the new one is in the ACTIVE state. When the newly added replica
is listed as ACTIVE, the index has been fully replicated to the newly added replica. The total time to replicate an index varies according to factors such as network
bandwidth and the size of the index. Replication times on the scale of hours are not uncommon and do not necessarily indicate a problem.

You can use the details command to get an XML document that contains information about replication progress. Use curl or a
browser to access a URI similar to:

If this documentation includes code, including but not limited to, code examples, Cloudera makes this available to you under the terms of the Apache License, Version 2.0, including any required
notices. A copy of the Apache License Version 2.0 can be found here.