简体   繁体   English

用于识别 Solr 服务器是在云还是独立模式下运行的 Java 代码

[英]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.我是 Solr 的新手,我正在使用 Java 应用程序使用 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.我想知道是否有适用于这两种模式的 API。 Or if there is any API to know the mode of running Solr server so that we use corresponding API based on that.或者如果有任何API可以知道运行Solr服务器的模式,以便我们基于此使用相应的API。

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. Collections Admin API 具有比常规 CoreAdminAPI 具有的相关参数多得多的参数,因此据我所知,没有您可以使用的通用 API。

You can however determine the current mode by making a request to /solr/admin/info/system?wt=json .但是,您可以通过向/solr/admin/info/system?wt=json发出请求来确定当前模式。 The JSON response will include a mode parameter: JSON 响应将包含一个mode参数:

"mode":"solrcloud",

This will tell you if Solr is running in cloud mode or standalone.这将告诉您 Solr 是在云模式下运行还是独立运行。 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.使用浏览器的开发人员工具的网络窗格通常是查看 Solr 通过其 API 公开的关于自身的所有信息的好方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM