Support Questions

Find answers, ask questions, and share your expertise

solr create_collection

Contributor

Does anyone know if we have an option for solr create_collection command to specify the nodes for the index to be created on?

1 ACCEPTED SOLUTION

@Arti Wadhwani

I believe this is what you are looking for

https://cwiki.apache.org/confluence/display/solr/Collections+API

createNodeSetstringNoAllows defining the nodes to spread the new collection across. If not provided, the CREATE operation will create shard-replica spread across all live Solr nodes. The format is a comma-separated list of node_names, such aslocalhost:8983_solr, localhost:8984_solr,localhost:8985_solr. Alternatively, use the special value of EMPTY to initially create no shard-replica within the new collection and then later use the ADDREPLICA operation to add shard-replica when and where required.

View solution in original post

11 REPLIES 11

@Arti Wadhwani

I believe this is what you are looking for

https://cwiki.apache.org/confluence/display/solr/Collections+API

createNodeSetstringNoAllows defining the nodes to spread the new collection across. If not provided, the CREATE operation will create shard-replica spread across all live Solr nodes. The format is a comma-separated list of node_names, such aslocalhost:8983_solr, localhost:8984_solr,localhost:8985_solr. Alternatively, use the special value of EMPTY to initially create no shard-replica within the new collection and then later use the ADDREPLICA operation to add shard-replica when and where required.

You have to use the option "createNodeSet"

Allows defining the nodes to spread the new collection across. If not provided, the CREATE operation will create shard-replica spread across all live Solr nodes. The format is a comma-separated list of node_names, such as localhost:8983_solr, localhost:8984_solr,localhost:8985_solr. Alternatively, use the special value of EMPTY to initially create no shard-replica within the new collection and then later use the ADDREPLICA operation to add shard-replica when and where required.

For example:

http://localhost:8983/solr/admin/collections?action=CREATE&name=newCollection&numShards=2&replicatio...

See full documentation here

Thanks @Jonas Straub for the example.

Contributor

Thanks @Neeraj Sabharwal and @Jonas Straub.

Already asked customer to try this option but it did not work via command line. Did I miss something?

tried it and it didn't recognise the option: 

solr create_collection -c universe_counts -d /home/xyz/solrhorton/solr_universe_counts/universe_counts/ -n universe_counts -shards 1 -replicationFactor 3 -createNodeSet xyz01:8983_solr,xyz03:8983_solr,xyz05:8983_solr 

ERROR: Unrecognized or misplaced argument: -createNodeSet! 


Usage: solr create_collection [-c collection] [-d confdir] [-n configName] [-shards #] [-replicationFactor #] [-p port]

Agree with @Neeraj Sabharwal this is an API specific command, I dont think this option is available via "solr create_collection..."

@Arti Wadhwani Did it work?

New Contributor

You can use a command line utility like 'curl' or 'wget' to make this REST PUT request from the command line.

Super Guru
@Neeraj Sabharwal

/ @Jonas Straub - how to pass -d confdir option in API ?

You can use collection.configName, however make sure you have already uploaded the configuration to your Zookeeper znode. If you dont use collection.configName, Solr asumes the configuration is stored under the name of the collection.

Mentor

@Arti Wadhwani are you still having issues with this? Can you accept best answer or provide your own solution?