Examples of CloudSolrServer


Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

    setupCollection(collectionName);

    // Send a update request and try to set the update.chain to skip the
    // index-authorization checks
    setAuthenticationUser("junit");
    CloudSolrServer server = getCloudSolrServer(collectionName);
    try {
      String path = "/" + collectionName + "/update?update.chain=skipUpdateIndexAuthorization&commit=true";
      String body = "<add><doc><field name=\"id\">testInvariantDoc</field></doc></add>";
      String ret = makeHttpRequest(server, "POST", path, body.getBytes("UTF-8"), "text/xml");
      assertTrue("Expected sentry exception", ret.contains("SentrySolrAuthorizationException: User junit"
        + " does not have privileges for testInvariantCollection"));
    } finally {
      server.shutdown();
    }
  }
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

   
    this.maxDocumentLength = maxDocumentLength;
   
    try
    {
      CloudSolrServer cloudSolrServer = new CloudSolrServer(zookeeperHosts);
      cloudSolrServer.setZkClientTimeout(zkClientTimeout);
      cloudSolrServer.setZkConnectTimeout(zkConnectTimeout);
      cloudSolrServer.setDefaultCollection(collection);
      // Set the solrj instance we want to use
      solrServer = cloudSolrServer;
    }
    catch (MalformedURLException e)
    {
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

      this.adminServer = new HttpSolrServer(solrServerUrl);
      this.server = new HttpSolrServer( solrServerUrl + "/" + mapping.getCoreName() );
      // CloudSolrServer - denoted by "cloud" in properties
    } else if (solrJServerType.toString().toLowerCase().equals("cloud")) {
      LOG.info("Using CloudSolrServer Solrj implementation.");
      this.adminServer = new CloudSolrServer(solrServerUrl);
      this.server = new CloudSolrServer( solrServerUrl + "/" + mapping.getCoreName() );
    } else if (solrJServerType.toString().toLowerCase().equals("concurrent")) {
      LOG.info("Using ConcurrentUpdateSolrServer Solrj implementation.");
      this.adminServer = new ConcurrentUpdateSolrServer(solrServerUrl, 1000, 10);
      this.server = new ConcurrentUpdateSolrServer( solrServerUrl + "/" + mapping.getCoreName(), 1000, 10);
      // LBHttpSolrServer - denoted by "loadbalance" in properties
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

   
    this.maxDocumentLength = maxDocumentLength;
   
    try
    {
      CloudSolrServer cloudSolrServer = new CloudSolrServer(zookeeperHosts);
      cloudSolrServer.setZkClientTimeout(zkClientTimeout);
      cloudSolrServer.setZkConnectTimeout(zkConnectTimeout);
      cloudSolrServer.setDefaultCollection(collection);
      // Set the solrj instance we want to use
      solrServer = cloudSolrServer;
    }
    catch (MalformedURLException e)
    {
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

   
    this.maxDocumentLength = maxDocumentLength;
   
    try
    {
      CloudSolrServer cloudSolrServer = new CloudSolrServer(zookeeperHosts, new ModifiedLBHttpSolrServer(HttpClientUtil.createClient(null)));
      cloudSolrServer.setZkClientTimeout(zkClientTimeout);
      cloudSolrServer.setZkConnectTimeout(zkConnectTimeout);
      cloudSolrServer.setDefaultCollection(collection);
      // Set the solrj instance we want to use
      solrServer = cloudSolrServer;
    }
    catch (MalformedURLException e)
    {
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

    }

    private SolrServer initializeWithCloudSolrServer() throws IOException, SolrServerException {
        // try SolrCloud client
        CloudSolrServer cloudSolrServer = new CloudSolrServer(solrZkHost);
        cloudSolrServer.connect();
        cloudSolrServer.setDefaultCollection("collection1"); // workaround for first request when the needed collection may not exist

        // create specified collection if it doesn't exists
        createCollectionIfNeeded(cloudSolrServer);

        cloudSolrServer.setDefaultCollection(solrCollection);

        // SolrCloud may need some time to sync on collection creation (to spread it over the shards / replicas)
        int i = 0;
        while (i < 3) {
            try {
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

            } else {
                log.info("JETTY RUNNING AT " + jetty.getBaseUrl() + " PORT " + jetty.getLocalPort());
            }
        }

        solrClient = new CloudSolrServer(zkAddr, true);
        solrClient.connect();

        createCollection(solrClient, "collection1", 1, 1, "conf1");
        Thread.sleep(1000); // takes some time to setup the collection...
                            // otherwise you'll get no live solr servers
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

    public SolrComponent getComponent() {
        return (SolrComponent) super.getComponent();
    }
   
    private CloudSolrServer getCloudServer() {
        CloudSolrServer rVal = null;
        if (this.getZkHost() != null && this.getCollection() != null) {
            rVal = new CloudSolrServer(zkHost);
            rVal.setDefaultCollection(this.getCollection());
        }
        return rVal;
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

        // do we have servers?
        SolrComponent.SolrServerReference ref = getComponent().getSolrServers(this);
        if (ref == null) {
            // no then create new servers
            ref = new SolrComponent.SolrServerReference();
            CloudSolrServer cloudServer = getCloudServer();
            if (cloudServer == null) {
                HttpSolrServer solrServer = new HttpSolrServer(url);
                ConcurrentUpdateSolrServer solrStreamingServer = new ConcurrentUpdateSolrServer(url, streamingQueueSize, streamingThreadCount);

                // set the properties on the solr server
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

                Resources.toByteArray(Resources.getResource(IndexerIT.class, "schema.xml")),
                Resources.toByteArray(Resources.getResource(IndexerIT.class, "solrconfig.xml")));
        solrTestingUtility.createCore("collection1_core1", "collection1", "config1", 1);
        solrTestingUtility.createCore("collection2_core1", "collection2", "config1", 1);

        collection1 = new CloudSolrServer(solrTestingUtility.getZkConnectString());
        collection1.setDefaultCollection("collection1");

        collection2 = new CloudSolrServer(solrTestingUtility.getZkConnectString());
        collection2.setDefaultCollection("collection2");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.