gpt4 book ai didi

org.apache.solr.common.cloud.ZkConfigManager.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 23:22:19 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.solr.common.cloud.ZkConfigManager.<init>()方法的一些代码示例,展示了ZkConfigManager.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkConfigManager.<init>()方法的具体详情如下:
包路径:org.apache.solr.common.cloud.ZkConfigManager
类名称:ZkConfigManager
方法名:<init>

ZkConfigManager.<init>介绍

[英]Creates a new ZkConfigManager
[中]创建一个新的ZkConfigManager

代码示例

代码示例来源:origin: org.apache.solr/solr-solrj

public ZkStateReader(SolrZkClient zkClient, Runnable securityNodeListener) {
 this.zkClient = zkClient;
 this.configManager = new ZkConfigManager(zkClient);
 this.closeClient = false;
 this.securityNodeListener = securityNodeListener;
}

代码示例来源:origin: org.apache.solr/solr-solrj

public static void downConfig(SolrZkClient zkClient, String confName, Path confPath) throws IOException {
 ZkConfigManager manager = new ZkConfigManager(zkClient);
 // Try to download the configset
 manager.downloadConfigDir(confName, confPath);
}

代码示例来源:origin: org.apache.solr/solr-solrj

public static void upConfig(SolrZkClient zkClient, Path confPath, String confName) throws IOException {
 ZkConfigManager manager = new ZkConfigManager(zkClient);
 // Try to download the configset
 manager.uploadConfigDir(confPath, confName);
}

代码示例来源:origin: org.apache.solr/solr-solrj

public ZkStateReader(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout) {
 this.zkClient = new SolrZkClient(zkServerAddress, zkClientTimeout, zkClientConnectTimeout,
   // on reconnect, reload cloud info
   new OnReconnect() {
    @Override
    public void command() {
     try {
      ZkStateReader.this.createClusterStateWatchersAndUpdate();
     } catch (KeeperException e) {
      log.error("A ZK error has occurred", e);
      throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
     } catch (InterruptedException e) {
      // Restore the interrupted status
      Thread.currentThread().interrupt();
      log.error("Interrupted", e);
      throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "Interrupted", e);
     }
    }
   });
 this.configManager = new ZkConfigManager(zkClient);
 this.closeClient = true;
 this.securityNodeListener = null;
}

代码示例来源:origin: org.apache.solr/solr-morphlines-core

/**
 * Download and return the config directory from ZK
 */
public File downloadConfigDir(SolrZkClient zkClient, String configName, File dir)
throws IOException, InterruptedException, KeeperException {
 Preconditions.checkArgument(dir.exists());
 Preconditions.checkArgument(dir.isDirectory());
 ZkConfigManager manager = new ZkConfigManager(zkClient);
 manager.downloadConfigDir(configName, dir.toPath());
 File confDir = new File(dir, "conf");
 if (!confDir.isDirectory()) {
  // create a temporary directory with "conf" subdir and mv the config in there.  This is
  // necessary because of CDH-11188; solrctl does not generate nor accept directories with e.g.
  // conf/solrconfig.xml which is necessary for proper solr operation.  This should work
  // even if solrctl changes.
  confDir = new File(Files.createTempDir().getAbsolutePath(), "conf");
  confDir.getParentFile().deleteOnExit();
  Files.move(dir, confDir);
  dir = confDir.getParentFile();
 }
 verifyConfigDir(confDir);
 return dir;
}

代码示例来源:origin: kite-sdk/kite

/**
 * Download and return the config directory from ZK
 */
public File downloadConfigDir(SolrZkClient zkClient, String configName, File dir)
throws IOException, InterruptedException, KeeperException {
 Preconditions.checkArgument(dir.exists());
 Preconditions.checkArgument(dir.isDirectory());
 ZkConfigManager manager = new ZkConfigManager(zkClient);
 manager.downloadConfigDir(configName, dir.toPath());
 File confDir = new File(dir, "conf");
 if (!confDir.isDirectory()) {
  // create a temporary directory with "conf" subdir and mv the config in there.  This is
  // necessary because of CDH-11188; solrctl does not generate nor accept directories with e.g.
  // conf/solrconfig.xml which is necessary for proper solr operation.  This should work
  // even if solrctl changes.
  confDir = new File(Files.createTempDir().getAbsolutePath(), "conf");
  confDir.getParentFile().deleteOnExit();
  Files.move(dir, confDir);
  dir = confDir.getParentFile();
 }
 verifyConfigDir(confDir);
 return dir;
}

代码示例来源:origin: com.hynnet/solr-solrj

public ZkStateReader(SolrZkClient zkClient, Runnable securityNodeListener) {
 this.zkClient = zkClient;
 this.cmdExecutor = new ZkCmdExecutor(zkClient.getZkClientTimeout());
 this.configManager = new ZkConfigManager(zkClient);
 this.closeClient = false;
 this.securityNodeListener = securityNodeListener;
}

代码示例来源:origin: jetoile/hadoop-unit

private void populateZkWithCollectionInfo() {
  System.setProperty("zkHost", zkHostString);
  try {
    URL url = ConfigurationUtils.locate(FileSystem.getDefaultFileSystem(), "", solrDirectory + "/collection1/conf");
    if (url == null) {
      try {
        url = new URL(solrDirectory + "/collection1/conf");
      } catch (MalformedURLException e) {
        LOGGER.error("unable to load solr config", e);
      }
    }
    URI solrDirectoryFile = url.toURI();
    try (SolrZkClient zkClient = new SolrZkClient(zkHostString, TIMEOUT, 45000, null)) {
      ZkConfigManager manager = new ZkConfigManager(zkClient);
      manager.uploadConfigDir(Paths.get(solrDirectoryFile), solrCollectionName);
    }
  } catch (URISyntaxException | IOException e) {
    LOGGER.error("unable to populate zookeeper", e);
  }
}

代码示例来源:origin: NGDATA/hbase-indexer

/**
 * Utility method to upload a Solr config into ZooKeeper. If you don't have the config in the form of
 * a filesystem directory, you might want to use {@link #uploadConfig(String, byte[], byte[])}.
 */
public void uploadConfig(String confName, File confDir) throws IOException {
  SolrZkClient zkClient = new SolrZkClient(zkConnectString, 30000, 30000,
      new OnReconnect() {
        @Override
        public void command() {
        }
      });
  new ZkConfigManager(zkClient).uploadConfigDir(confDir.toPath(), confName);
  zkClient.close();
}

代码示例来源:origin: com.ngdata/hbase-indexer-common

/**
 * Utility method to upload a Solr config into ZooKeeper. If you don't have the config in the form of
 * a filesystem directory, you might want to use {@link #uploadConfig(String, byte[], byte[])}.
 */
public void uploadConfig(String confName, File confDir) throws IOException {
  SolrZkClient zkClient = new SolrZkClient(zkConnectString, 30000, 30000,
      new OnReconnect() {
        @Override
        public void command() {
        }
      });
  new ZkConfigManager(zkClient).uploadConfigDir(confDir.toPath(), confName);
  zkClient.close();
}

代码示例来源:origin: com.cloudera.search/search-mr

File dir = Files.createTempDir();
dir.deleteOnExit();
ZkConfigManager configManager = new ZkConfigManager(zkClient);
configManager.downloadConfigDir(configName, dir.toPath());
File confDir = new File(dir, "conf");

代码示例来源:origin: com.hynnet/solr-solrj

public ZkStateReader(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout) {
 this.zkClient = new SolrZkClient(zkServerAddress, zkClientTimeout, zkClientConnectTimeout,
   // on reconnect, reload cloud info
   new OnReconnect() {
    @Override
    public void command() {
     try {
      ZkStateReader.this.createClusterStateWatchersAndUpdate();
     } catch (KeeperException e) {
      log.error("", e);
      throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
        "", e);
     } catch (InterruptedException e) {
      // Restore the interrupted status
      Thread.currentThread().interrupt();
      log.error("", e);
      throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
        "", e);
     }
    }
   });
 this.cmdExecutor = new ZkCmdExecutor(zkClientTimeout);
 this.configManager = new ZkConfigManager(zkClient);
 this.closeClient = true;
 this.securityNodeListener = null;
}

代码示例来源:origin: org.apache.solr/solr-test-framework

/**
 * Upload a config set
 * @param configDir a path to the config set to upload
 * @param configName the name to give the configset
 */
public void uploadConfigSet(Path configDir, String configName) throws IOException, KeeperException, InterruptedException {
 try(SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(),
   AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT, null)) {
  ZkConfigManager manager = new ZkConfigManager(zkClient);
  manager.uploadConfigDir(configDir, configName);
 }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com