Support Questions

Find answers, ask questions, and share your expertise

Move Solr server from one host to another using Cloudera Parcels

avatar
Rising Star

I would like to move a Solr server from one host to another host that has a lot more memory using Cloudera. I am using CDH 5.2 with CM 5.2. My questions: Is it possible to move the Solr server from one host to another? What about the indexes, how are they moved? Any advice would be appreciated. 

1 ACCEPTED SOLUTION

avatar
Cloudera Employee

Hi,

 

If you don't have data saved in Solr, then moving solr servers is very staright forward by adding a new solr server role on the new host using Cloudera Manager.

 

If you already have data saved in solr, then in addition to the above step you also need to move the solr cores of current host to the new host. And here are the steps to move the core.

 

Instructions

The supported procedure to migrate a replica from one server to another is as follows: Migrating from:cdh5-2.cloudera.local
Collection: students
Replica name: students_shard1_replica2
Migrating to:cdh5-3.cloudera.local
Collection: students
Replica name: students_shard1_replica3
  1. On the target server, from a command line, add the Core with the following API call (Core Admin UI is not recommended):

    curl http://cdh5-3.cloudera.local:8983/solr/admin/cores?action=CREATE&name=students_shard1_replica3&colle...

    Note: Name should be a new replica name, but should conform to collection_shardn_replican for consistency. If two replicas exist in the current shard, use replica3 in the name to avoid conflicts.

  2. Verify that the core is created, and moves from recovery state to UP.

  3. On the old node, from a command line, run the following UNLOAD command (again, Core Admin UI is not recommended), which will remove the core.properties in /var/lib/solr on the old node:

    curl http://cdh5-2.cloudera.local:8983/solr/admin/cores?action=UNLOAD&core=students_shard1_replica2&delet...

    Note: If the old node is down or Solr unavailable, the above command will fail. Manually remove the core.properties under /var/lib/solr/collection_shardn_replican so the node does not attempt to register that replica when it starts.

  4. Verify in the CLOUD UI that the old replica has been removed.

Important: To speed recovery time, suspend any incoming ingestion while the new replica is doing a full replication from the leader. NRT ingestion can then be turned back on.

 

After the above steps, you can remove the solr server from the first host if required (use Cloudera Manager to handle this)

View solution in original post

11 REPLIES 11

avatar
Cloudera Employee

Hi,

 

If you don't have data saved in Solr, then moving solr servers is very staright forward by adding a new solr server role on the new host using Cloudera Manager.

 

If you already have data saved in solr, then in addition to the above step you also need to move the solr cores of current host to the new host. And here are the steps to move the core.

 

Instructions

The supported procedure to migrate a replica from one server to another is as follows: Migrating from:cdh5-2.cloudera.local
Collection: students
Replica name: students_shard1_replica2
Migrating to:cdh5-3.cloudera.local
Collection: students
Replica name: students_shard1_replica3
  1. On the target server, from a command line, add the Core with the following API call (Core Admin UI is not recommended):

    curl http://cdh5-3.cloudera.local:8983/solr/admin/cores?action=CREATE&name=students_shard1_replica3&colle...

    Note: Name should be a new replica name, but should conform to collection_shardn_replican for consistency. If two replicas exist in the current shard, use replica3 in the name to avoid conflicts.

  2. Verify that the core is created, and moves from recovery state to UP.

  3. On the old node, from a command line, run the following UNLOAD command (again, Core Admin UI is not recommended), which will remove the core.properties in /var/lib/solr on the old node:

    curl http://cdh5-2.cloudera.local:8983/solr/admin/cores?action=UNLOAD&core=students_shard1_replica2&delet...

    Note: If the old node is down or Solr unavailable, the above command will fail. Manually remove the core.properties under /var/lib/solr/collection_shardn_replican so the node does not attempt to register that replica when it starts.

  4. Verify in the CLOUD UI that the old replica has been removed.

Important: To speed recovery time, suspend any incoming ingestion while the new replica is doing a full replication from the leader. NRT ingestion can then be turned back on.

 

After the above steps, you can remove the solr server from the first host if required (use Cloudera Manager to handle this)

avatar

sorry for my question ,

 

i can follow  this steps olse if i want to add more node to my solr cluster ?

 

kind regard's

avatar
Khaled,
  If you'd like to add more replicas to existing shards, you can use this method with the CREATE action on the new nodes that you want to add replicas to. If you need to add more shards, you'll want to recreate the collection with a larger number of shards after you've added solr to the new nodes.

avatar

that is mean if i will create new collection and i have plan to increase number of nodes i must create shared more than number of current node number

 

for example : if i have cluster with 4 node now but i have plan to add more 4 node in future , i must create my collection with 8 shared to be able to increase number of my nodes to 8 node? true

avatar
If you are wanting to add more shards (to better distribute the updates), then yes, I would suggest planning in advance and oversharding. If you are more concerned about query performance, and want to keep the same number of shards but just add more replicas per shard, then just creating replicas on the new nodes will be sufficient.

avatar

thank you for your replay

 

can you give me stepes i will follw to add more node to running solr cluster

 

thanks

avatar
Contributor

Can please give me steps to add replicas of an existing shard ?

 Thanks !

avatar

If you are using CDH5.4, you can use the collections API ADDREPLICA command to add a replica for a given shard [1].  Pay attention to the format of the node parameter, it needs to be hostname:8983_solr

 

 

[1] https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api_addreplica

 

avatar
Contributor

I tried ADD REPLICA, but I get error message that specified shard does not exist.

I have a CDH 5.4 cluster, with two solr roles

solrserver1
solrserver2

on solrserver1 I have

1- collecitonname : mycolleciton , instaceDir : /var/lib/solr/mycollection_shard1_replica1/

I want to replicate it on solrserver2, so I tried the command


http://solrserver1:8983/solr/admin/collections?action=ADDREPLICA&collection=mycollection&shard=mycollection_shard1_replica1&node=solrserver2:8983_solr

and I got the message

Collection: mycollection shard: mycollection_shard1_replica1 does not exist

 

Really appreciate your help