On 8/20/2021 2:00 AM, Ravi Mishra wrote:
# My solr is working just fine I run few command to verify:
$ curl "http://0.0.0.0:8983/solr/admin/collections?action=clusterstatus&wt=xml";
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
   <int name="status">0</int>
   <int name="QTime">19</int>
</lst>
<lst name="cluster">
   <lst name="collections"/>
   <arr name="live_nodes">
     <str>192.168.1.2:8983_solr</str>
   </arr>
</lst>
</response>

This would indicate that Solr is running in cloud mode (connected to ZooKeeper).  This is a call to the Collections API, which only works in cloud mode.  If that URL path is attempted when you're not in cloud mode, this is what Solr returns:|
|

|<response> <lst name="responseHeader"> <int name="status">400</int> <int name="QTime">27</int> </lst> <lst name="error"> <lst name="metadata"> <str name="error-class">org.apache.solr.common.SolrException</str> <str name="root-error-class">org.apache.solr.common.SolrException</str> </lst> <str name="msg">Solr instance is not running in SolrCloud mode.</str> <int name="code">400</int> </lst> </response>|

||

||

# When I tried to create core it was failing with below error, before
running this command I created folder name “a10” under solr home
directory “/var/solr/solr/cores”

$ curl 
"http://0.0.0.0:8983/solr/admin/cores?action=CREATE&name=a10&instanceDir=cores/a10&shard=shard10&collection=conf1&coreNodeName=a10&wt=xml";

               <?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
  <int name="status">400</int>
  <int name="QTime">10067</int>
</lst>
<lst name="error">
  <lst name="metadata">
<str name="error-class">org.apache.solr.common.SolrException</str>
<str 
name="root-error-class">org.apache.solr.cloud.ZkController$NotInClusterStateException</str>
  </lst>
  <str name="msg">Error CREATEing SolrCore 'a10': coreNodeName a10 does
not exist in shard shard10, ignore the exception if the replica was
deleted</str>
  <int name="code">400</int>
</lst>
</response>

The CoreAdmin API that you are using here should never be used when you're in cloud mode.  Even experts can't use it successfully.  It is not cloud-aware, so the necessary changes to the clusterstate before and after creating a core will not be done, even if you somehow managed to get a CoreAdmin API call to succeed.  Use the collections API, not CoreAdmin.  One bonus to the Collections API:  You do not need to create directories before calling the API when you're in cloud mode.  Solr will create them for you.

Thanks,
Shawn

Reply via email to