How can I manipulate the multicore in solr dynamically

梦想的初衷 提交于 2019-12-13 01:14:02

问题


I am new to apache solr.
I want to manipulate the multicore dynamically using CoreAdminHandler class of
org.apache.solr.handler.admin.CoreAdminHandler;

There are no tutorials on how to use it nor any good example I could google out.
Please give me some example of how can I manipulate multicore which are deployed in tomcat(not embedded) using CoreAdminHandler and solrj.
How can I specify the path of my tomcat server where solr is deployed for CoreAdminHandler/coreContainer.
And how to specify the path where multicores are placed?


回答1:


Here is an example you can use to get the list of the available cores through a status request:

CoreAdminRequest adminRequest = new CoreAdminRequest();
adminRequest.setAction(CoreAdminAction.STATUS);
CoreAdminResponse adminResponse = adminRequest.process(new CommonsHttpSolrServer(solrUrl));
NamedList<NamedList<Object>> coreStatus = adminResponse.getCoreStatus();

The following are the available CoreAdmin actions you can use:

STATUS,  
LOAD,
UNLOAD,
RELOAD,
CREATE,
PERSIST,
SWAP,
RENAME,
@Deprecated
ALIAS,
MERGEINDEXES;

The code you can use is pretty much the same, you just have to pick the right action and correctly read the results within the returned NamedList object. Let me know if you have some more specific question.



来源:https://stackoverflow.com/questions/10696553/how-can-i-manipulate-the-multicore-in-solr-dynamically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!