Package net.sf.katta.util

Examples of net.sf.katta.util.ZkConfiguration


      _parameterString = parameterString;
      _description = description;
    }

    public final void parseArguments(String[] args) throws Exception {
      parseArguments(new ZkConfiguration(), args, parseOptionMap(args));
    }
View Full Code Here


            throws Exception {
      // subclasses may override
    }

    public void execute() throws Exception {
      execute(new ZkConfiguration());
    }
View Full Code Here

  private ZkConfiguration _conf;
  private ZkClient _zkClient;

  public ZkTool() {
    _conf = new ZkConfiguration();
    _zkClient = ZkKattaUtil.startZkClient(_conf, 5000);
  }
View Full Code Here

  }

  @Override
  public void nodeOperationsComplete(MasterContext context, List<OperationResult> results) throws Exception {
    ZkClient zkClient = context.getProtocol().getZkClient();
    ZkConfiguration zkConf = context.getProtocol().getZkConfiguration();
    for (Shard shard : _indexMD.getShards()) {
      zkClient.deleteRecursive(zkConf.getZkPath(PathDef.SHARD_TO_NODES, shard.getName()));
    }
  }
View Full Code Here

  private static KattaMiniCluster _cluster1;
  private static KattaMiniCluster _cluster2;

  @BeforeClass
  public static void onBeforeClass() throws Exception {
    ZkConfiguration conf1 = new ZkConfiguration();
    ZkConfiguration conf2 = new ZkConfiguration();
    conf1.setZKRootPath("MultiClusterTest/pool1");
    conf2.setZKRootPath("MultiClusterTest/pool2");

    _zkServer = ZkKattaUtil.startZkServer(new ZkConfiguration());
    _cluster1 = new KattaMiniCluster(SleepServer.class, conf1, POOL_SIZE_1, 30000);
    _cluster2 = new KattaMiniCluster(SleepServer.class, conf2, POOL_SIZE_2, 40000);
    _cluster1.setZkServer(_zkServer);
    _cluster2.setZkServer(_zkServer);
    _cluster1.start();
View Full Code Here

  @SuppressWarnings("deprecation")
  @Override
  public void upgrade(InteractionProtocol protocol) {
    ZkClient zkClient = protocol.getZkClient();
    ZkConfiguration zkConf = protocol.getZkConfiguration();
    ZkClient zkClientForWriables = new ZkClient(zkConf.getZKServers(), 5000, 5000, new WriteableZkSerializer(
            net.sf.katta.index.IndexMetaData.class));
    LOG.info("restoring indices meta data...");
    String oldIndicesPath = getOldIndicesPath(zkConf);
    List<String> indices = zkClient.getChildren(oldIndicesPath);
    LOG.info("found " + indices.size() + " old indices");
    for (String indexName : indices) {
      net.sf.katta.index.IndexMetaData oldIndexMD = zkClientForWriables.readData(oldIndicesPath + "/" + indexName);
      IndexMetaData newIndexMD = new IndexMetaData(indexName, oldIndexMD.getPath(), oldIndexMD.getReplicationLevel());
      IndexReinitializeOperation deployOperation = new IndexReinitializeOperation(newIndexMD);
      protocol.addMasterOperation(deployOperation);
      protocol.publishIndex(newIndexMD);
    }
    zkClientForWriables.close();

    LOG.info("deleting obsolete folders...");
    zkClient.deleteRecursive(zkConf.getZkRootPath() + "/" + "indexes");
    zkClient.deleteRecursive(zkConf.getZkRootPath() + "/" + "node-to-shard");
    zkClient.deleteRecursive(zkConf.getZkRootPath() + "/" + "shard-to-node");
    zkClient.deleteRecursive(zkConf.getZkRootPath() + "/" + "loadtest-nodes");
    zkClient.deleteRecursive(zkConf.getZkRootPath() + "/" + "server-metrics");
    zkClient.deleteRecursive(zkConf.getZkRootPath() + "/" + "shard-to-error");

    LOG.info("upgrade done");
  }
View Full Code Here

    }, TimeUnit.SECONDS, 30);
    assertThat(operationQueuesEmpty(protocol, master, nodes)).as("node operation queues are empty").isTrue();
  }

  private static Boolean operationQueuesEmpty(final InteractionProtocol protocol, Master master, final List<Node> nodes) {
    ZkConfiguration zkConf = protocol.getZkConfiguration();
    if (protocol.getZkClient().countChildren(zkConf.getZkPath(PathDef.MASTER_QUEUE, "operations")) > 0) {
      return false;
    }
    for (Node node : nodes) {
      if (protocol.getZkClient().countChildren(zkConf.getZkPath(PathDef.NODE_QUEUE, node.getName(), "operations")) > 0) {
        return false;
      }
    }

    return true;
View Full Code Here

  private static KattaMiniCluster _luceneCluster;
  private static KattaMiniCluster _loadtestCluster;

  @BeforeClass
  public static void onBeforeClass() throws Exception {
    ZkConfiguration conf1 = new ZkConfiguration();
    ZkConfiguration conf2 = new ZkConfiguration();
    conf1.setZKRootPath("LuceneLoadIntegrationTest/luceneCluster");
    conf2.setZKRootPath("LuceneLoadIntegrationTest/loadtestCluster");
    cleanup(conf1);
    cleanup(conf2);
    FileUtil.deleteFolder(new NodeConfiguration().getShardFolder());

    _zkServer = ZkKattaUtil.startZkServer(new ZkConfiguration());
    _luceneCluster = new KattaMiniCluster(LuceneServer.class, conf1, NODE_COUNT_LUCENE, 30000);
    _loadtestCluster = new KattaMiniCluster(SleepServer.class, conf2, NODE_COUNT_LOADTEST, 40000);
    _luceneCluster.setZkServer(_zkServer);
    _loadtestCluster.setZkServer(_zkServer);
    _luceneCluster.start();
View Full Code Here

  private InteractionProtocol _protocol = mock(InteractionProtocol.class);

  @Before
  public void setUp() {
    when(_protocol.getZkConfiguration()).thenReturn(new ZkConfiguration());
    ZkClient mock = mock(ZkClient.class);
    when(_protocol.getZkClient()).thenReturn(mock);
  }
View Full Code Here

  public Class<? extends IContentServer> getContentServerClass() {
    return _contentServerClass;
  }

  private final KattaMiniCluster startMiniCluster(int nodeCount, int indexCount, int replicationCount) throws Exception {
    ZkConfiguration conf = new ZkConfiguration();
    FileUtil.deleteFolder(new File(conf.getZKDataDir()));
    FileUtil.deleteFolder(new File(conf.getZKDataLogDir()));
    FileUtil.deleteFolder(new NodeConfiguration().getShardFolder());

    // start katta cluster
    _miniCluster = new KattaMiniCluster(_contentServerClass, conf, nodeCount, _lastNodeStartPort);
    // we permanently start the node on other
View Full Code Here

TOP

Related Classes of net.sf.katta.util.ZkConfiguration

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.