Dhruvajyoti Chatterjee
Dhruvajyoti Chatterjee

Reputation: 199

Java code to identify Solr server is running in Cloud or standalone mode

I am new to Solr and I am using java application to list the collections using CollectionAdminReqest API. But it fails when server is in standalone mode.

I want to know if there is any API that works for both modes. Or if there is any API to know the mode of running Solr server so that we use corresponding API based on that.

Upvotes: 1

Views: 685

Answers (2)

user1499055
user1499055

Reputation: 1

Once on your Solr Administration User Interface, just make the following request on the browser : http://enteryourservername:enteryourportno/solr/admin/info/system?wt=json

The response returned will look something like this (look out for the value of mode which will be std for standalone and solrcloud for cloud based) -

{"responseHeader":{"status":0,"QTime":0},"mode":"std",....

Upvotes: 0

MatsLindh
MatsLindh

Reputation: 52802

The Collections Admin API has far more parameters that are relevant than what the regular CoreAdminAPI has, so as far as I know there is no common API you can use.

You can however determine the current mode by making a request to /solr/admin/info/system?wt=json. The JSON response will include a mode parameter:

"mode":"solrcloud",

This will tell you if Solr is running in cloud mode or standalone. Using your browser's developer tools' network pane is usually a good way to see all the information Solr exposes about itself through its API.

Upvotes: 1

Related Questions