Examples of AmbariCluster


Examples of org.apache.ambari.view.slider.clients.AmbariCluster

    ViewStatus status = new ViewStatus();
    List<String> viewErrors = new ArrayList<String>();

    AmbariClusterInfo clusterInfo = ambariClient.getClusterInfo();
    if (clusterInfo != null) {
      AmbariCluster cluster = ambariClient.getCluster(clusterInfo);
      List<AmbariServiceInfo> services = cluster.getServices();
      if (services != null && !services.isEmpty()) {
        AmbariServiceInfo hdfsService = null, yarnService = null, zkService = null;
        for (AmbariServiceInfo service : services) {
          if ("HDFS".equals(service.getId())) {
            hdfsService = service;
          } else if ("YARN".equals(service.getId())) {
            yarnService = service;
          } else if ("ZOOKEEPER".equals(service.getId())) {
            zkService = service;
          }
        }
        if (hdfsService == null) {
          viewErrors.add("Slider applications view requires HDFS service");
        } else {
          if (!hdfsService.isStarted()) {
            viewErrors
                .add("Slider applications view requires HDFS service to be started");
          }
        }
        if (yarnService == null) {
          viewErrors.add("Slider applications view requires YARN service");
        } else {
          if (!yarnService.isStarted()) {
            viewErrors
                .add("Slider applications view requires YARN service to be started");
          }
        }
        if (zkService == null) {
          viewErrors.add("Slider applications view requires ZooKeeper service");
        } else {
          if (!zkService.isStarted()) {
            viewErrors
                .add("Slider applications view requires ZooKeeper service to be started");
          }
        }
      } else {
        viewErrors
            .add("Slider applications view is unable to locate any services");
      }
      // Check security
      if (cluster.getDesiredConfigs() != null
          && cluster.getDesiredConfigs().containsKey("global")) {
        Map<String, String> globalConfig = ambariClient.getConfiguration(
            clusterInfo, "global", cluster.getDesiredConfigs().get("global"));
        if (globalConfig != null
            && globalConfig.containsKey("security_enabled")) {
          String securityValue = globalConfig.get("security_enabled");
          if (Boolean.valueOf(securityValue)) {
            viewErrors
View Full Code Here

Examples of org.apache.ambari.view.slider.clients.AmbariCluster

   * Dynamically determines Slider client configuration. If unable to determine, <code>null</code> is returned.
   *
   * @return
   */
  private Configuration getSliderClientConfiguration() {
    AmbariCluster ambariCluster = getAmbariCluster();
    if (ambariCluster != null) {
      AmbariService zkService = ambariClient.getService(ambariCluster,
                                                        "ZOOKEEPER");
      if (zkService != null && ambariCluster.getDesiredConfigs() != null
          && ambariCluster.getDesiredConfigs().containsKey("global")
          && ambariCluster.getDesiredConfigs().containsKey("yarn-site")
          && ambariCluster.getDesiredConfigs().containsKey("core-site")) {
        Map<String, String> globalConfigs = ambariClient.getConfiguration(
            ambariCluster, "global",
            ambariCluster.getDesiredConfigs().get("global"));
        Map<String, String> yarnSiteConfigs = ambariClient.getConfiguration(
            ambariCluster, "yarn-site",
            ambariCluster.getDesiredConfigs().get("yarn-site"));
        Map<String, String> coreSiteConfigs = ambariClient.getConfiguration(
            ambariCluster, "core-site",
            ambariCluster.getDesiredConfigs().get("core-site"));
        String zkPort = globalConfigs.get("clientPort");
        String hdfsPath = coreSiteConfigs.get("fs.defaultFS");
        String rmAddress = yarnSiteConfigs.get("yarn.resourcemanager.address");
        String rmSchedulerAddress = yarnSiteConfigs
            .get("yarn.resourcemanager.scheduler.address");
View Full Code Here

Examples of org.apache.ambari.view.slider.clients.AmbariCluster

      File resourcesJsonFile = new File(appCreateFolder, "resources.json");
      saveAppConfigs(configs, componentsArray, appConfigJsonFile);
      saveAppResources(componentsArray, resourcesJsonFile);

      AmbariClusterInfo clusterInfo = ambariClient.getClusterInfo();
      AmbariCluster cluster = ambariClient.getCluster(clusterInfo);
      Map<String, String> coreSiteConfigs = ambariClient.getConfiguration(
          clusterInfo, "core-site", cluster.getDesiredConfigs()
          .get("core-site"));
      String hdfsLocation = coreSiteConfigs.get("fs.defaultFS");
      final ActionCreateArgs createArgs = new ActionCreateArgs();
      createArgs.template = appConfigJsonFile;
      createArgs.resources = resourcesJsonFile;
View Full Code Here

Examples of org.apache.ambari.view.slider.clients.AmbariCluster

    if (clusterInfo != null) {
      try {
        JsonElement jsonElement = doGetJson("/api/v1/clusters/"
            + clusterInfo.getName());
        if (jsonElement != null) {
          AmbariCluster cluster = new AmbariCluster();
          // desired configs
          Map<String, String> desiredConfigs = new HashMap<String, String>();
          JsonObject desiredConfigsObj = jsonElement.getAsJsonObject()
              .get("Clusters").getAsJsonObject().get("desired_configs")
              .getAsJsonObject();
          for (Map.Entry<String, JsonElement> entry : desiredConfigsObj
              .entrySet()) {
            desiredConfigs.put(entry.getKey(), entry.getValue()
                .getAsJsonObject().get("tag").getAsString());
          }
          cluster.setDesiredConfigs(desiredConfigs);
          // services
          List<AmbariServiceInfo> services = new ArrayList<AmbariServiceInfo>();
          cluster.setServices(services);
          // hosts
          List<AmbariHostInfo> hosts = new ArrayList<AmbariHostInfo>();
          cluster.setHosts(hosts);
          return cluster;
        }
      } catch (HttpException e) {
        logger.warn("Unable to determine Ambari cluster details - "
            + clusterInfo.getName(), e);
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.