Search in sources :

Example 6 with HttpShardHandlerFactory

use of org.apache.solr.handler.component.HttpShardHandlerFactory in project lucene-solr by apache.

the class OverseerTest method electNewOverseer.

private SolrZkClient electNewOverseer(String address) throws InterruptedException, TimeoutException, IOException, KeeperException, ParserConfigurationException, SAXException {
    SolrZkClient zkClient = new SolrZkClient(address, TIMEOUT);
    ZkStateReader reader = new ZkStateReader(zkClient);
    readers.add(reader);
    LeaderElector overseerElector = new LeaderElector(zkClient);
    if (overseers.size() > 0) {
        overseers.get(overseers.size() - 1).close();
        overseers.get(overseers.size() - 1).getZkStateReader().getZkClient().close();
    }
    UpdateShardHandler updateShardHandler = new UpdateShardHandler(UpdateShardHandlerConfig.DEFAULT);
    updateShardHandlers.add(updateShardHandler);
    HttpShardHandlerFactory httpShardHandlerFactory = new HttpShardHandlerFactory();
    httpShardHandlerFactorys.add(httpShardHandlerFactory);
    Overseer overseer = new Overseer(httpShardHandlerFactory.getShardHandler(), updateShardHandler, "/admin/cores", reader, null, new CloudConfig.CloudConfigBuilder("127.0.0.1", 8983, "").build());
    overseers.add(overseer);
    ElectionContext ec = new OverseerElectionContext(zkClient, overseer, address.replaceAll("/", "_"));
    overseerElector.setup(ec);
    overseerElector.joinElection(ec, false);
    return zkClient;
}
Also used : ZkStateReader(org.apache.solr.common.cloud.ZkStateReader) SolrZkClient(org.apache.solr.common.cloud.SolrZkClient) UpdateShardHandler(org.apache.solr.update.UpdateShardHandler) HttpShardHandlerFactory(org.apache.solr.handler.component.HttpShardHandlerFactory)

Aggregations

HttpShardHandlerFactory (org.apache.solr.handler.component.HttpShardHandlerFactory)6 ZkStateReader (org.apache.solr.common.cloud.ZkStateReader)4 UpdateShardHandler (org.apache.solr.update.UpdateShardHandler)4 SolrZkClient (org.apache.solr.common.cloud.SolrZkClient)3 ArrayList (java.util.ArrayList)2 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 Collection (java.util.Collection)1 ExecutorService (java.util.concurrent.ExecutorService)1 Future (java.util.concurrent.Future)1 FTSQueryException (org.alfresco.repo.search.impl.parsers.FTSQueryException)1 ParseException (org.apache.lucene.queryparser.classic.ParseException)1 LBHttpSolrClient (org.apache.solr.client.solrj.impl.LBHttpSolrClient)1 QueryRequest (org.apache.solr.client.solrj.request.QueryRequest)1 CoreContainer (org.apache.solr.core.CoreContainer)1 ShardHandlerFactory (org.apache.solr.handler.component.ShardHandlerFactory)1 SAXPathException (org.jaxen.saxpath.SAXPathException)1 After (org.junit.After)1 Test (org.junit.Test)1