Reputation: 151
I am trying to create core dynamically through my java appliction in solr cloud having two shard.
CloudSolrServer cloudSolrServer = new CloudSolrServer("localhost:9983", new LBHttpSolrServer ("http://localhost:8983/solr"));
CoreAdminRequest.Create req = new CoreAdminRequest.Create() {
private static final long serialVersionUID = -8825247378713661625L;
@Override public SolrParams getParams() {
ModifiableSolrParams modifiableSolrParams = (ModifiableSolrParams) super.getParams();
modifiableSolrParams.set("collection.configName", "mycore");
return modifiableSolrParams;
}
};
req.setInstanceDir("/solr/master/mycorepath");
req.setCollection("mycore");
CoreAdminResponse res = req.process(cloudSolrServer.getLbServer());
However i am getting the error: Specified config does not exist in ZooKeeper:mycore
When I checked in the solr admin console I found the collection "mycore" is not completely created[i.e it does not have the folder symbol] and there is no config with the name "mycore".
How do I go about this problem. What is the standard way for creating core dynamically in a 2 shard solr cloud (solr 4.1.0)?
Upvotes: 2
Views: 1251
Reputation: 151
I have successfully created collection with solr4.4 having two shards and no replicas using collections api
CloudSolrServer cs = new CloudSolrServer("localhost:9983");
CollectionAdminResponse res=CollectionAdminRequest.createCollection("testCollection", 2, 1, 1, "127.0.1.1:7574_solr,127.0.1.1:8983_solr", "myconf", null, cs);
This will create a collection with compositeID router
myconf is the configuration name that has been uploaded to zoo keeper during the cluster start up.
Upvotes: 1
Reputation: 1367
I too am using Solr 4.1.0, and was having some trouble creating a core. I'm only using one shard, but I answered another question along similar lines here.
Upvotes: 0