Examples of ClusterState


Examples of com.alibaba.jstorm.cluster.ClusterState

  @SuppressWarnings("rawtypes")
  private void init() throws Exception {

    NimbusClient client = null;
    ClusterState cluster_state = null;
    try {
      LOG.info("MainPage init...");
      Map conf = UIUtils.readUiConfig();
     
      if(clusterName != null && !(clusterName.equals(""))) {
        UIUtils.getClusterInfoByName(conf, clusterName);
      }
     
      client = NimbusClient.getConfiguredClient(conf);
      summ = client.getClient().getClusterInfo();

      tsumm = UIUtils.topologySummary(summ.get_topologies());
      csumm = UIUtils.clusterSummary(summ, client, conf);
      ssumm = UIUtils.supervisorSummary(summ.get_supervisors());

      cluster_state = ZkTool.mk_distributed_cluster_state(client
          .getConf());
      slaves = getNimbusSlave(cluster_state, conf);

      zkServers = getZkServer(conf);
      zkPort = String.valueOf(conf.get(Config.STORM_ZOOKEEPER_PORT));

    } catch (Exception e) {
      String errorInfo = e.getMessage();
      if (errorInfo.indexOf("No alive nimbus") == -1) {
          LOG.error("Failed to get cluster information:", e);
          throw e;
      }
    } finally {
      if (client != null) {
        client.close();
      }
      if (cluster_state != null) {
        cluster_state.close();
      }
    }
  }
View Full Code Here

Examples of com.alipay.bluewhale.core.cluster.ClusterState

      else{
    String stromId=args[0];
    System.out.println(client.getTopologyInfo(stromId));
   
   
    ClusterState cluster_state = new DistributedClusterState(conf);
    StormClusterState zk = new StormZkClusterState(
      cluster_state);
    for(Integer taskid:zk.task_ids(stromId))
    {
      System.out.println("########"+taskid);
View Full Code Here

Examples of com.alipay.bluewhale.core.cluster.ClusterState

    public static StormClusterState getCluster() throws Exception
    {
  if(higozkCluster==null)
  {
          Map stormconf = Utils.readStormConfig();
          ClusterState zkClusterstate =Cluster.mk_distributed_cluster_state(stormconf);
          higozkCluster = Cluster.mk_storm_cluster_state(zkClusterstate);
  }
  return higozkCluster;
    }
View Full Code Here

Examples of com.alipay.bluewhale.core.cluster.ClusterState

  }

  private static void runTable(String[] args) throws Exception {
    String tableName = args[1];
    Map stormconf = Utils.readStormConfig();
    ClusterState zkClusterstate = Cluster
        .mk_distributed_cluster_state(stormconf);
    StormClusterState zkCluster = Cluster
        .mk_storm_cluster_state(zkClusterstate);
    zkCluster.higo_remove(tableName);
    zkCluster.disconnect();
View Full Code Here

Examples of com.alipay.bluewhale.core.cluster.ClusterState

    } catch (Exception e) {
      e.printStackTrace();
    }

    Map stormconf = Utils.readStormConfig();
    ClusterState zkClusterstate = Cluster
        .mk_distributed_cluster_state(stormconf);
    StormClusterState zkCluster = Cluster
        .mk_storm_cluster_state(zkClusterstate);
    zkCluster.higo_remove(topologyName);
    for (String s : tableName.split(",")) {
View Full Code Here

Examples of io.fathom.auto.zookeeper.model.ClusterState

        while (!zk.isRunning()) {
            log.info("Checking zookeeper cluster creation state");

            try {
                ClusterState clusterState = cluster.readClusterState();
                if (clusterState != null && clusterState.isCreated()) {
                    log.info("Zookeeper cluster is created");
                    break;
                } else {
                    log.info("Zookeeper cluster state: {}", clusterState);
                }
            } catch (IOException e) {
                log.warn("Error reading cluster state", e);
                TimeSpan.seconds(10).sleep();
                continue;
            }

            try {
                if (cluster.getLock().tryLock(1, TimeUnit.MINUTES)) {
                    // We've got the lock...
                    ClusterSnapshot snapshot = cluster.getSnapshot();

                    ClusterState state = snapshot.getClusterState();
                    if (state == null || !state.isCreated()) {
                        // If we haven't created the data yet, everybody should
                        // be an observer
                        for (ZookeeperClusterRegistration server : snapshot.servers.values()) {
                            if (!server.isObserver()) {
                                // TODO: It may be that the leader crashed
                                // mid-create...
                                throw new IllegalStateException("Found non-observer server in uninitialized cluster");
                            }
                        }

                        registration.type = ZookeeperClusterRegistration.PARTICIPANT;
                        cluster.writeRegistration(myid, registration);

                        snapshot.servers.put(myid, registration);

                        config.writeHosts(snapshot);
                        config.writeConfig(snapshot, myid);

                        zk.start();

                        if (state == null) {
                            state = new ClusterState();
                        }
                        state.createdBy = String.valueOf(myid);

                        cluster.writeClusterState(state);
                    }
View Full Code Here

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

      while (cont) {
        if (verbose) LOG.debug("-");
        boolean sawLiveRecovering = false;
        zkStateReader.updateClusterState(true);
        ClusterState clusterState = zkStateReader.getClusterState();
        Map<String, Slice> slices = clusterState.getSlicesMap(collection);
        assertNotNull("Could not find collection:" + collection, slices);
        for (Map.Entry<String, Slice> entry : slices.entrySet()) {
          Map<String, Replica> shards = entry.getValue().getReplicasMap();
          for (Map.Entry<String, Replica> shard : shards.entrySet()) {
            if (verbose) LOG.debug("rstate:"
                + shard.getValue().getStr(ZkStateReader.STATE_PROP) + " live:"
                + clusterState.liveNodesContain(shard.getValue().getNodeName()));
            String state = shard.getValue().getStr(ZkStateReader.STATE_PROP);
            if ((state.equals(ZkStateReader.RECOVERING)
                || state.equals(ZkStateReader.SYNC) || state
                .equals(ZkStateReader.DOWN))
                && clusterState.liveNodesContain(shard.getValue().getStr(
                ZkStateReader.NODE_NAME_PROP))) {
              sawLiveRecovering = true;
            }
          }
        }
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState

    public Set<String> getAllMessageFields() {
        Set<String> fields = Sets.newHashSet();

        ClusterStateRequest csr = new ClusterStateRequest().blocks(true).nodes(true).indices(allIndicesAlias());
        ClusterState cs = c.admin().cluster().state(csr).actionGet().getState();

        for (ObjectObjectCursor<String, IndexMetaData> m : cs.getMetaData().indices()) {
            try {
                MappingMetaData mmd = m.value.mapping(Messages.TYPE);
                if (mmd == null) {
                    // There is no mapping if there are no messages in the index.
                    continue;
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState

        // Open index.
        c.admin().indices().open(new OpenIndexRequest(index)).actionGet();
    }

    public boolean isReopened(String indexName) {
        ClusterState clusterState = c.admin().cluster().state(new ClusterStateRequest()).actionGet().getState();
        IndexMetaData metaData = clusterState.getMetaData().getIndices().get(indexName);

        if (metaData == null) {
            return false;
        }
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState

                .nodes(false)
                .routingTable(false)
                .blocks(false)
                .metaData(true);

        ClusterState state = c.admin().cluster().state(csr).actionGet().getState();

        UnmodifiableIterator<IndexMetaData> it = state.getMetaData().getIndices().valuesIt();

        while (it.hasNext()) {
            IndexMetaData indexMeta = it.next();
            // Only search in our indices.
            if (!indexMeta.getIndex().startsWith(configuration.getElasticSearchIndexPrefix())) {
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.