Package org.apache.solr.common.cloud

Examples of org.apache.solr.common.cloud.SolrZkClient


    zkClient.makePath(destPath, file, false, true);
  }
 
  private void uploadConfFiles() throws Exception {
    // upload our own config files
    SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(), 10000);
    putConfig(zkClient, SOLR_CONF_DIR, "solrconfig.xml");
    putConfig(zkClient, SOLR_CONF_DIR, "schema.xml");
    putConfig(zkClient, SOLR_CONF_DIR, "elevate.xml");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_en.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ar.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_bg.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ca.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_cz.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_da.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_el.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_es.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_eu.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_de.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_fa.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_fi.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_fr.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ga.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_gl.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_hi.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_hu.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_hy.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_id.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_it.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ja.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_lv.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_nl.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_no.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_pt.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ro.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ru.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_sv.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_th.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_tr.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_ca.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_fr.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_ga.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_it.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stemdict_nl.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "lang/hyphenations_ga.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "stopwords.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "protwords.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "currency.xml");
    putConfig(zkClient, SOLR_CONF_DIR, "open-exchange-rates.json");
    putConfig(zkClient, SOLR_CONF_DIR, "mapping-ISOLatin1Accent.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "old_synonyms.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "synonyms.txt");
    zkClient.close();
  }
View Full Code Here


        if (collectionName == null || collectionName.length() == 0) {
          throw new MorphlineCompilationException(
              "Parameter 'zkHost' requires that you also pass parameter 'collection'", config);
        }
        ZooKeeperDownloader zki = new ZooKeeperDownloader();
        SolrZkClient zkClient = zki.getZkClient(zkHost);
        try {
          String configName = zki.readConfigName(zkClient, collectionName);
          downloadedSolrHomeDir = Files.createTempDir();
          downloadedSolrHomeDir = zki.downloadConfigDir(zkClient, configName, downloadedSolrHomeDir);
          mySolrHomeDir = downloadedSolrHomeDir.getAbsolutePath();
        } catch (KeeperException e) {
          throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
        } catch (InterruptedException e) {
          throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
        } catch (IOException e) {
          throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
        } finally {
          zkClient.close();
        }
      }
     
      LOG.debug("SolrLocator loading IndexSchema from dir {}", mySolrHomeDir);
      try {
View Full Code Here

      if (collectionName == null || collectionName.length() == 0) {
        throw new MorphlineCompilationException(
            "Parameter 'zkHost' requires that you also pass parameter 'collection'", config);
      }
      ZooKeeperDownloader zki = new ZooKeeperDownloader();
      SolrZkClient zkClient = zki.getZkClient(zkHost);
      try {
        String configName = zki.readConfigName(zkClient, collectionName);
        File downloadedSolrHomeDir = zki.downloadConfigDir(zkClient, configName);
        mySolrHomeDir = downloadedSolrHomeDir.getAbsolutePath();
      } catch (KeeperException e) {
        throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
      } catch (InterruptedException e) {
        throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
      } catch (IOException e) {
        throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
      } finally {
        zkClient.close();
      }
    }
   
    LOG.debug("SolrLocator loading IndexSchema from dir {}", mySolrHomeDir);
    try {
View Full Code Here

  public SolrZkClient getZkClient(String zkHost) {
    if (zkHost == null) {
      throw new IllegalArgumentException("zkHost must not be null");
    }

    SolrZkClient zkClient;
    try {
      zkClient = new SolrZkClient(zkHost, 30000);
    } catch (Exception e) {
      throw new IllegalArgumentException("Cannot connect to ZooKeeper: " + zkHost, e);
    }
    return zkClient;
  }
View Full Code Here

    zkClient.makePath(destPath, file, false, true);
  }
 
  private void uploadConfFiles() throws Exception {
    // upload our own config files
    SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(), 10000);
    putConfig(zkClient, SOLR_CONF_DIR, "solrconfig.xml");
    putConfig(zkClient, SOLR_CONF_DIR, "schema.xml");
    putConfig(zkClient, SOLR_CONF_DIR, "elevate.xml");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_en.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ar.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_bg.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ca.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_cz.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_da.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_el.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_es.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_eu.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_de.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_fa.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_fi.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_fr.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ga.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_gl.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_hi.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_hu.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_hy.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_id.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_it.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ja.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_lv.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_nl.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_no.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_pt.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ro.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_ru.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_sv.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_th.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stopwords_tr.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_ca.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_fr.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_ga.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "lang/contractions_it.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "lang/stemdict_nl.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "lang/hyphenations_ga.txt");
   
    putConfig(zkClient, SOLR_CONF_DIR, "stopwords.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "protwords.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "currency.xml");
    putConfig(zkClient, SOLR_CONF_DIR, "open-exchange-rates.json");
    putConfig(zkClient, SOLR_CONF_DIR, "mapping-ISOLatin1Accent.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "old_synonyms.txt");
    putConfig(zkClient, SOLR_CONF_DIR, "synonyms.txt");
    zkClient.close();
  }
View Full Code Here

      SolrOutputFormat.setupSolrHomeCache(options.solrHomeDir, job);
    } else {
      assert options.zkHost != null;
      // use the config that this collection uses for the SolrHomeCache.
      ZooKeeperInspector zki = new ZooKeeperInspector();
      SolrZkClient zkClient = zki.getZkClient(options.zkHost);
      try {
        String configName = zki.readConfigName(zkClient, options.collection);
        File tmpSolrHomeDir = zki.downloadConfigDir(zkClient, configName);
        SolrOutputFormat.setupSolrHomeCache(tmpSolrHomeDir, job);
        options.solrHomeDir = tmpSolrHomeDir;
      } finally {
        zkClient.close();
      }
    }
   
    MorphlineMapRunner runner = setupMorphline(options);
    if (options.isDryRun && runner != null) {
View Full Code Here

 
  public DocCollection extractDocCollection(String zkHost, String collection) {
    if (collection == null) {
      throw new IllegalArgumentException("collection must not be null");
    }
    SolrZkClient zkClient = getZkClient(zkHost);
   
    try {
      ZkStateReader zkStateReader = new ZkStateReader(zkClient);
      try {
        // first check for alias
        collection = checkForAlias(zkClient, collection);
        zkStateReader.createClusterStateWatchersAndUpdate();
      } catch (Exception e) {
        throw new IllegalArgumentException("Cannot find expected information for SolrCloud in ZooKeeper: " + zkHost, e);
      }
     
      try {
        return zkStateReader.getClusterState().getCollection(collection);
      } catch (SolrException e) {
        throw new IllegalArgumentException("Cannot find collection '" + collection + "' in ZooKeeper: " + zkHost, e);
      }
    } finally {
      zkClient.close();
    }   
  }
View Full Code Here

  public SolrZkClient getZkClient(String zkHost) {
    if (zkHost == null) {
      throw new IllegalArgumentException("zkHost must not be null");
    }

    SolrZkClient zkClient;
    try {
      zkClient = new SolrZkClient(zkHost, 30000);
    } catch (Exception e) {
      throw new IllegalArgumentException("Cannot connect to ZooKeeper: " + zkHost, e);
    }
    return zkClient;
  }
View Full Code Here

    zkClient.makePath(destPath, file, false, true);
  }
 
  private void uploadConfFiles() throws Exception {
    // upload our own config files
    SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(), 10000);
    putConfig(zkClient, new File(RESOURCES_DIR + "/solr/solrcloud"),
        "solrconfig.xml");
    putConfig(zkClient, MINIMR_CONF_DIR, "schema.xml");
    putConfig(zkClient, MINIMR_CONF_DIR, "elevate.xml");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_en.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_ar.txt");
   
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_bg.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_ca.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_cz.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_da.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_el.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_es.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_eu.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_de.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_fa.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_fi.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_fr.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_ga.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_gl.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_hi.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_hu.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_hy.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_id.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_it.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_ja.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_lv.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_nl.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_no.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_pt.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_ro.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_ru.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_sv.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_th.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stopwords_tr.txt");
   
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/contractions_ca.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/contractions_fr.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/contractions_ga.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/contractions_it.txt");
   
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/stemdict_nl.txt");
   
    putConfig(zkClient, MINIMR_CONF_DIR, "lang/hyphenations_ga.txt");
   
    putConfig(zkClient, MINIMR_CONF_DIR, "stopwords.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "protwords.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "currency.xml");
    putConfig(zkClient, MINIMR_CONF_DIR, "open-exchange-rates.json");
    putConfig(zkClient, MINIMR_CONF_DIR, "mapping-ISOLatin1Accent.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "old_synonyms.txt");
    putConfig(zkClient, MINIMR_CONF_DIR, "synonyms.txt");
    zkClient.close();
  }
View Full Code Here

    private void createCollectionIfNeeded(CloudSolrServer cloudSolrServer) throws SolrServerException, IOException {
        String solrCollection = remoteSolrServerConfiguration.getSolrCollection();
        try {
            ZkStateReader zkStateReader = cloudSolrServer.getZkStateReader();
            SolrZkClient zkClient = zkStateReader.getZkClient();
            if (zkClient.isConnected() && !zkClient.exists("/configs/" + solrCollection, false)) {
                String solrConfDir = remoteSolrServerConfiguration.getSolrConfDir();
                File dir;
                if (solrConfDir != null && solrConfDir.length() > 0) {
                    dir = new File(solrConfDir);
                } else {
View Full Code Here

TOP

Related Classes of org.apache.solr.common.cloud.SolrZkClient

Copyright © 2018 www.massapicom. 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.