1
votes

I've followed the "Getting Started Guide", the Two-Shards / Two-Replicas secnario and everything worked perfectly. Then I started using the Collections API which is the preferable way of managing collection,shards and replication.

I launched two instances locally (afterwards with AWS, same problem) I created a new collection with two shards using the following command: /admin/collections?action=CREATE&name=collection1&numShards=2&collection.configName=collection This successfully created two shards, one on each instance. Then I launched another instance, expecting it to automatically set itself as a replica for the first shard, just like in the example. That didn't happen.

Is there something I'm missing?

There were two ways I was able to achieve this:

  1. Manually, using the Collections API, I added a replica to shard1 and then another to shard2. This is not good enough, as I will need to have this done automatically with Auto Scaling, so I'll need to micro-manage each server "role" - which replicas of which shards of which collections its handling, which complicates things a lot

  2. The second way, which I couldn't find a documentation for is to launch an instance with a folder named "collectionX", inside a file named core.properties. In it the following line: collection=collection1 Each instance I launched that way was automatically added as a replica in a round-robin way. (Also working with several collections) That's actually not a bad way at all, as I can pass parameter when I launch an AMI/instance in AWS.

Thanks everyone.

Amir

1

1 Answers

0
votes

1) You are running the wrong command; the complete command is as follows:

curl 'http://localhost:8080/solr/admin/collections?action=CREATE&name=corename&numShards=2&replicationFactor=2&maxShardsPerNode=10'

Here I have given replication factor and due to which it will create the replica for your shards.