You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by nishwanth <ni...@gmail.com> on 2014/09/09 08:00:00 UTC

Creating Solr servers dynamically in Multicore folder

Hello ,

I  am using solr 4.8.1 Version and and i am trying to create the cores
dynamically on server start up using the following piece of code.

 HttpSolrServer s = new HttpSolrServer( url );
	    s.setParser(new BinaryResponseParser());
	    s.setRequestWriter(new BinaryRequestWriter());
	    SolrServer server = s;
	  	String instanceDir ="/opt/solr/core/multicore/";
	  	CoreAdminResponse e =  new CoreAdminRequest().createCore(name,
instanceDir,
server,"/opt/solr/core/multicore/solrconfig.xml","/opt/solr/core/multicore/schema.xml");

I am getting the error 

org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Error
CREA
TEing SolrCore 'hellocore': Could not create a new core in
/opt/solr/core/multic
ore/as another core is already defined there
        at
org.apache.solr.client.solrj.impl.HttpSolrServer.executeMethod(HttpSo
lrServer.java:554)
        at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServ
er.java:210)
        at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServ
er.java:206)
        at
org.apache.solr.client.solrj.request.CoreAdminRequest.process(CoreAdm
inRequest.java:503)
        at
org.apache.solr.client.solrj.request.CoreAdminRequest.createCore(Core
AdminRequest.java:580)
        at
org.apache.solr.client.solrj.request.CoreAdminRequest.createCore(Core
AdminRequest.java:560)
        at
app.services.OperativeAdminScheduler.scheduleTask(OperativeAdminSched
uler.java:154)
        at Global.onStart(Global.java:31)

I am still getting the above error even  though the core0 and core1 folders
in multicore are deleted and the same is commented in
/opt/solr/core/multicore/solrconfig.xml. Also i enabled persistent=true in
the solrconfig.xml 



--
View this message in context: http://lucene.472066.n3.nabble.com/Creating-Solr-servers-dynamically-in-Multicore-folder-tp4157550.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Creating Solr servers dynamically in Multicore folder

Posted by nishwanth <ni...@gmail.com>.
Hello Erick,

Thanks for the response 

I have attached the core.properties and solr.xml for your reference.

.  solr.xml <http://lucene.472066.n3.nabble.com/file/n4158124/solr.xml>  
core.properties
<http://lucene.472066.n3.nabble.com/file/n4158124/core.properties>  

Below is our plan on the creating cores.

Every Tenant (user) is  bound to some Contacts,sales,Orders and other
information . Numbers of tenants for our application will be approximately
10,000. 

We are planning to create a Core for every Tenant and maintain the
Contacts,sales,Orders and other information as a collection . So every time
Tenant logs in this information will be used.

Could you please let us know your thoughts on this approach.

Regards,
Nishwanth




--
View this message in context: http://lucene.472066.n3.nabble.com/Creating-Solr-servers-dynamically-in-Multicore-folder-tp4157550p4158124.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Creating Solr servers dynamically in Multicore folder

Posted by Erick Erickson <er...@gmail.com>.
You should be good to go. Do note that you can the variables that were
defined in your schema.xml in the individual core.properties file for
the core in question if you need to, although the defaults work for
most people's needs.


Best,
Erick

On Tue, Sep 9, 2014 at 9:15 PM, nishwanth <ni...@gmail.com> wrote:
> Hello Erick,
>
> Thanks for the response . My cores got created now after removing the
> core.properties in this location and the existing core folders .
>
> Also i commented the core related information on solr.xml . Are there going
> to be any further problems with the approach i followed.
>
> For the new cores i created could see the conf,data and core.properties file
> getting created.
>
> Thanks..
>
>
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Creating-Solr-servers-dynamically-in-Multicore-folder-tp4157550p4157747.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Creating Solr servers dynamically in Multicore folder

Posted by nishwanth <ni...@gmail.com>.
Hello Erick,

Thanks for the response . My cores got created now after removing the
core.properties in this location and the existing core folders . 

Also i commented the core related information on solr.xml . Are there going
to be any further problems with the approach i followed.

For the new cores i created could see the conf,data and core.properties file
getting created.

Thanks..






--
View this message in context: http://lucene.472066.n3.nabble.com/Creating-Solr-servers-dynamically-in-Multicore-folder-tp4157550p4157747.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Creating Solr servers dynamically in Multicore folder

Posted by Erick Erickson <er...@gmail.com>.
Well, you already have a core.properties file defined in that
location. I presume you're operating in "core discovery" mode. Your
cores would all be very confused if new cores were defined over top of
old cores.

It is a little clumsy at this point in that you have to have a conf
directory in place but _not_ a core.properties file to create a core
like this. Config sets will eventually fix this.

Best,
Erick

On Mon, Sep 8, 2014 at 11:00 PM, nishwanth <ni...@gmail.com> wrote:
> Hello ,
>
> I  am using solr 4.8.1 Version and and i am trying to create the cores
> dynamically on server start up using the following piece of code.
>
>  HttpSolrServer s = new HttpSolrServer( url );
>             s.setParser(new BinaryResponseParser());
>             s.setRequestWriter(new BinaryRequestWriter());
>             SolrServer server = s;
>                 String instanceDir ="/opt/solr/core/multicore/";
>                 CoreAdminResponse e =  new CoreAdminRequest().createCore(name,
> instanceDir,
> server,"/opt/solr/core/multicore/solrconfig.xml","/opt/solr/core/multicore/schema.xml");
>
> I am getting the error
>
> org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Error
> CREA
> TEing SolrCore 'hellocore': Could not create a new core in
> /opt/solr/core/multic
> ore/as another core is already defined there
>         at
> org.apache.solr.client.solrj.impl.HttpSolrServer.executeMethod(HttpSo
> lrServer.java:554)
>         at
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServ
> er.java:210)
>         at
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServ
> er.java:206)
>         at
> org.apache.solr.client.solrj.request.CoreAdminRequest.process(CoreAdm
> inRequest.java:503)
>         at
> org.apache.solr.client.solrj.request.CoreAdminRequest.createCore(Core
> AdminRequest.java:580)
>         at
> org.apache.solr.client.solrj.request.CoreAdminRequest.createCore(Core
> AdminRequest.java:560)
>         at
> app.services.OperativeAdminScheduler.scheduleTask(OperativeAdminSched
> uler.java:154)
>         at Global.onStart(Global.java:31)
>
> I am still getting the above error even  though the core0 and core1 folders
> in multicore are deleted and the same is commented in
> /opt/solr/core/multicore/solrconfig.xml. Also i enabled persistent=true in
> the solrconfig.xml
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Creating-Solr-servers-dynamically-in-Multicore-folder-tp4157550.html
> Sent from the Solr - User mailing list archive at Nabble.com.