/** * Propagate all global keys matching a prefix * @param src source * @param prefix prefix */ public void propagateGlobalKeys(ConfTree src, String prefix) { Map<String, String> global = src.global; for (Map.Entry<String, String> entry : global.entrySet()) { String key = entry.getKey(); if (key.startsWith(prefix)) { set(key, entry.getValue()); } } }
/** * Propagate all global keys matching a prefix * @param src source * @param prefix prefix */ public void propagateGlobalKeys(ConfTree src, String prefix) { Map<String, String> global = src.global; for (Map.Entry<String, String> entry : global.entrySet()) { String key = entry.getKey(); if (key.startsWith(prefix)) { set(key, entry.getValue()); } } }
public void propagateFilename() { String fsDefaultName = conf.get( CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY); instanceDescription.getAppConfOperations().set(OptionKeys.SITE_XML_PREFIX + CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, fsDefaultName ); instanceDescription.getAppConfOperations().set(OptionKeys.SITE_XML_PREFIX + SliderXmlConfKeys.FS_DEFAULT_NAME_CLASSIC, fsDefaultName ); }
/** * Propagate any critical principals from the current site config down to the HBase one. */ public void propagatePrincipals() { String dfsPrincipal = conf.get(SliderXmlConfKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY); if (dfsPrincipal != null) { String siteDfsPrincipal = OptionKeys.SITE_XML_PREFIX + SliderXmlConfKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY; instanceDescription.getAppConfOperations().set(siteDfsPrincipal, dfsPrincipal); } }
/** * Propagate any critical principals from the current site config down to the HBase one. */ public void propagatePrincipals() { String dfsPrincipal = conf.get(SliderXmlConfKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY); if (dfsPrincipal != null) { String siteDfsPrincipal = OptionKeys.SITE_XML_PREFIX + SliderXmlConfKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY; instanceDescription.getAppConfOperations().set(siteDfsPrincipal, dfsPrincipal); } }
public void propagateFilename() { String fsDefaultName = conf.get( CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY); instanceDescription.getAppConfOperations().set(OptionKeys.SITE_XML_PREFIX + CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, fsDefaultName ); instanceDescription.getAppConfOperations().set(OptionKeys.SITE_XML_PREFIX + SliderXmlConfKeys.FS_DEFAULT_NAME_CLASSIC, fsDefaultName ); }
System.currentTimeMillis()); internalOps.set(INTERNAL_AM_TMP_DIR, instancePaths.tmpPathAM.toUri()); internalOps.set(INTERNAL_TMP_DIR, instancePaths.tmpPath.toUri()); internalOps.set(INTERNAL_SNAPSHOT_CONF_PATH, instancePaths.snapshotConfPath.toUri()); internalOps.set(INTERNAL_GENERATED_CONF_PATH, instancePaths.generatedConfPath.toUri()); internalOps.set(INTERNAL_DATA_DIR_PATH, instancePaths.dataPath.toUri()); internalOps.set(INTERNAL_APPDEF_DIR_PATH, instancePaths.appDefPath.toUri()); internalOps.set(INTERNAL_ADDONS_DIR_PATH, instancePaths.addonsPath.toUri()); internalOps.set(InternalKeys.INTERNAL_PROVIDER_NAME, provider); internalOps.set(OptionKeys.APPLICATION_NAME, clustername);
System.currentTimeMillis()); internalOps.set(INTERNAL_AM_TMP_DIR, instancePaths.tmpPathAM.toUri()); internalOps.set(INTERNAL_TMP_DIR, instancePaths.tmpPath.toUri()); internalOps.set(INTERNAL_SNAPSHOT_CONF_PATH, instancePaths.snapshotConfPath.toUri()); internalOps.set(INTERNAL_GENERATED_CONF_PATH, instancePaths.generatedConfPath.toUri()); internalOps.set(INTERNAL_DATA_DIR_PATH, instancePaths.dataPath.toUri()); internalOps.set(INTERNAL_APPDEF_DIR_PATH, instancePaths.appDefPath.toUri()); internalOps.set(INTERNAL_ADDONS_DIR_PATH, instancePaths.addonsPath.toUri()); internalOps.set(InternalKeys.INTERNAL_PROVIDER_NAME, provider); internalOps.set(OptionKeys.APPLICATION_NAME, clustername);
/** * Set up the image/app home path * @param appImage path in the DFS to the tar file * @param appHomeDir other strategy: home dir * @throws BadConfigException if both are found */ public void setImageDetailsIfAvailable( Path appImage, String appHomeDir) throws BadConfigException { boolean appHomeUnset = SliderUtils.isUnset(appHomeDir); // App home or image if (appImage != null) { if (!appHomeUnset) { // both args have been set throw new BadConfigException( ErrorStrings.E_BOTH_IMAGE_AND_HOME_DIR_SPECIFIED); } instanceDescription.getInternalOperations().set(INTERNAL_APPLICATION_IMAGE_PATH, appImage.toUri()); } else { // the alternative is app home, which now MUST be set if (!appHomeUnset) { instanceDescription.getInternalOperations().set(INTERNAL_APPLICATION_HOME, appHomeDir); } } }
/** * Set up the image/app home path * @param appImage path in the DFS to the tar file * @param appHomeDir other strategy: home dir * @throws BadConfigException if both are found */ public void setImageDetailsIfAvailable( Path appImage, String appHomeDir) throws BadConfigException { boolean appHomeUnset = SliderUtils.isUnset(appHomeDir); // App home or image if (appImage != null) { if (!appHomeUnset) { // both args have been set throw new BadConfigException( ErrorStrings.E_BOTH_IMAGE_AND_HOME_DIR_SPECIFIED); } instanceDescription.getInternalOperations().set(INTERNAL_APPLICATION_IMAGE_PATH, appImage.toUri()); } else { // the alternative is app home, which now MUST be set if (!appHomeUnset) { instanceDescription.getInternalOperations().set(INTERNAL_APPLICATION_HOME, appHomeDir); } } }
@Override public void prepareInstanceConfiguration(AggregateConf aggregateConf) throws SliderException, IOException { String resourceTemplate = INSTANCE_RESOURCE_BASE + "resources.json"; String appConfTemplate = INSTANCE_RESOURCE_BASE + "appconf.json"; mergeTemplates(aggregateConf, null, resourceTemplate, appConfTemplate); aggregateConf.getAppConfOperations().set(OPTION_ACCUMULO_PASSWORD, createAccumuloPassword()); }
/** * Set the queue used to start the application * @param queue * @throws BadConfigException */ public void setQueue(String queue) throws BadConfigException { if(queue != null) { if(SliderUtils.isUnset(queue)) { throw new BadConfigException("Queue value cannot be empty."); } instanceDescription.getInternalOperations().set(INTERNAL_QUEUE, queue); } }
/** * Set the queue used to start the application * @param queue * @throws BadConfigException */ public void setQueue(String queue) throws BadConfigException { if(queue != null) { if(SliderUtils.isUnset(queue)) { throw new BadConfigException("Queue value cannot be empty."); } instanceDescription.getInternalOperations().set(INTERNAL_QUEUE, queue); } }
@Override public void prepareAMAndConfigForLaunch(SliderFileSystem fileSystem, Configuration serviceConf, AbstractLauncher launcher, AggregateConf instanceDefinition, Path snapshotConfDirPath, Path generatedConfDirPath, Configuration clientConfExtras, String libdir, Path tempPath, boolean miniClusterTestRun) throws IOException, SliderException { String agentImage = instanceDefinition.getInternalOperations(). get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH); if (SliderUtils.isUnset(agentImage)) { Path agentPath = new Path(tempPath.getParent(), AgentKeys.PROVIDER_AGENT); log.info("Automatically uploading the agent tarball at {}", agentPath); fileSystem.getFileSystem().mkdirs(agentPath); if (ProviderUtils.addAgentTar(this, AGENT_TAR, fileSystem, agentPath)) { instanceDefinition.getInternalOperations().set( InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH, new Path(agentPath, AGENT_TAR).toUri()); } } }
@Override public void prepareAMAndConfigForLaunch(SliderFileSystem fileSystem, Configuration serviceConf, AbstractLauncher launcher, AggregateConf instanceDefinition, Path snapshotConfDirPath, Path generatedConfDirPath, Configuration clientConfExtras, String libdir, Path tempPath, boolean miniClusterTestRun) throws IOException, SliderException { String agentImage = instanceDefinition.getInternalOperations(). get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH); if (SliderUtils.isUnset(agentImage)) { Path agentPath = new Path(tempPath.getParent(), AgentKeys.PROVIDER_AGENT); log.info("Automatically uploading the agent tarball at {}", agentPath); fileSystem.getFileSystem().mkdirs(agentPath); if (ProviderUtils.addAgentTar(this, AGENT_TAR, fileSystem, agentPath)) { instanceDefinition.getInternalOperations().set( InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH, new Path(agentPath, AGENT_TAR).toUri()); } } }
ConfTreeOperations treeOps = aggConf.getAppConfOperations(); treeOps.getGlobalOptions().put(AgentKeys.JAVA_HOME, "java_home"); treeOps.set(OptionKeys.APPLICATION_NAME, "HBASE"); treeOps.set("site.fs.defaultFS", "hdfs://HOST1:8020/"); treeOps.set("internal.data.dir.path", "hdfs://HOST1:8020/database"); treeOps.set(OptionKeys.ZOOKEEPER_HOSTS, "HOST1");
ConfTreeOperations treeOps = aggConf.getAppConfOperations(); treeOps.getGlobalOptions().put(AgentKeys.JAVA_HOME, "java_home"); treeOps.set(OptionKeys.APPLICATION_NAME, "HBASE"); treeOps.set("site.fs.defaultFS", "hdfs://HOST1:8020/"); treeOps.set("internal.data.dir.path", "hdfs://HOST1:8020/database"); treeOps.set(OptionKeys.ZOOKEEPER_HOSTS, "HOST1");
treeOps.getOrAddComponent("HBASE_MASTER") .put(AgentKeys.WAIT_HEARTBEAT, "0"); treeOps.set(OptionKeys.APPLICATION_NAME, "HBASE"); treeOps.set("java_home", "/usr/jdk7/"); treeOps.set("site.fs.defaultFS", "hdfs://c6409.ambari.apache.org:8020"); treeOps.set(InternalKeys.INTERNAL_DATA_DIR_PATH, "hdfs://c6409.ambari.apache.org:8020/user/yarn/.slider/cluster/cl1/data"); expect(access.getInstanceDefinitionSnapshot()).andReturn(aggConf); expect(access.getInternalsSnapshot()).andReturn(treeOps).anyTimes();
treeOps.getOrAddComponent("HBASE_MASTER") .put(AgentKeys.WAIT_HEARTBEAT, "0"); treeOps.set(OptionKeys.APPLICATION_NAME, "HBASE"); treeOps.set("java_home", "/usr/jdk7/"); treeOps.set("site.fs.defaultFS", "hdfs://c6409.ambari.apache.org:8020"); treeOps.set(InternalKeys.INTERNAL_DATA_DIR_PATH, "hdfs://c6409.ambari.apache.org:8020/user/yarn/.slider/cluster/cl1/data"); expect(access.getInstanceDefinitionSnapshot()).andReturn(aggConf); expect(access.getInternalsSnapshot()).andReturn(treeOps).anyTimes();
ConfTreeOperations treeOps = aggConf.getAppConfOperations(); treeOps.getGlobalOptions().put(AgentKeys.JAVA_HOME, "java_home"); treeOps.set(OptionKeys.APPLICATION_NAME, "HBASE"); treeOps.set("site.fs.defaultFS", "hdfs://HOST1:8020/"); treeOps.set("internal.data.dir.path", "hdfs://HOST1:8020/database"); treeOps.set(OptionKeys.ZOOKEEPER_HOSTS, "HOST1"); treeOps.getGlobalOptions().put("site.hbase-site.a.port", "${HBASE_MASTER.ALLOCATED_PORT}"); treeOps.getGlobalOptions().put("site.hbase-site.b.port", "${HBASE_MASTER.ALLOCATED_PORT}");