use of org.talend.repository.hadoopcluster.configurator.HadoopConfiguratorBuilder in project tbd-studio-se by Talend.
the class ClouderaHadoopConfig512Test method testConfigurator_cdh512.
// FIXME: use Mock of Cloudera API or TestContainers framework (https://www.testcontainers.org/) to be able to test it.
@Ignore("ignored in buildme system, comment out this line when run locally")
@Test
public void testConfigurator_cdh512() throws Exception {
String folder = "/tmp/cm";
// 512
String url = "http://163.172.6.25:7180";
HadoopConfigurator configurator = new HadoopConfiguratorBuilder().withVendor(HadoopConfigurationManager.CLOUDERA_MANAGER).withBaseURL(new URL(url)).withUsernamePassword("talendwiz", "83RpC5MWcnZPbQyVaNxF").build();
TestUtil.checkCluster(configurator, "Cluster 1");
HadoopCluster cluster = configurator.getCluster(configurator.getAllClusters().get(0));
Map<HadoopHostedService, HadoopClusterService> services = cluster.getHostedServices();
TestUtil.checkService(services, HadoopHostedService.HDFS, HadoopHostedService.YARN, HadoopHostedService.HIVE, HadoopHostedService.HBASE);
TestUtil.checkServiceConf(services.get(HadoopHostedService.HDFS), "hdfs-site.xml", "core-site.xml");
TestUtil.checkServiceConf(services.get(HadoopHostedService.YARN), "yarn-site.xml", "hdfs-site.xml", "core-site.xml", "mapred-site.xml");
TestUtil.checkServiceConf(services.get(HadoopHostedService.HIVE), "hive-site.xml", "yarn-site.xml", "hdfs-site.xml", "core-site.xml", "mapred-site.xml");
TestUtil.checkServiceConf(services.get(HadoopHostedService.HBASE), "hbase-site.xml", "hdfs-site.xml", "core-site.xml");
}
use of org.talend.repository.hadoopcluster.configurator.HadoopConfiguratorBuilder in project tbd-studio-se by Talend.
the class TalendHadoopConfiguratorApiDemo method main.
public static void main(String[] args) {
try {
String folder = "/tmp/cm";
// HadoopConfigurator configurator = new HadoopConfiguratorBuilder()
// .withVendor(HadoopConfigurationManager.CLOUDERA_MANAGER).withBaseURL(new
// URL("http://192.168.32.35:7180"))
// .withUsernamePassword("admin", "admin").build();
HadoopConfigurator configurator = new HadoopConfiguratorBuilder().withVendor(HadoopConfigurationManager.AMBARI).withBaseURL(new URL("http://192.168.33.12:8080")).withUsernamePassword("admin", "talend").build();
// HadoopConfigurator configurator = new
// HadoopConfiguratorBuilder().withVendor(HadoopConfigurationManager.AMBARI)
// .withBaseURL(new URL("http://192.168.33.74:8080")).withUsernamePassword("admin", "admin").build();
System.out.println(configurator.getAllClusters());
HadoopCluster cluster = configurator.getCluster(configurator.getAllClusters().get(0));
Map<HadoopHostedService, HadoopClusterService> services = cluster.getHostedServices();
for (HadoopHostedService serviceName : services.keySet()) {
HadoopClusterService service = services.get(serviceName);
System.out.println("---------------------------------");
System.out.println("Service Name:" + serviceName);
Map<String, String> configuration = service.getConfiguration();
for (String key : configuration.keySet()) {
System.out.println(key + ":" + configuration.get(key));
}
System.out.println("---------------------------------");
service.exportConfigurationToXml(folder + "/" + serviceName);
// service.exportConfigurationToXml(folder);
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
use of org.talend.repository.hadoopcluster.configurator.HadoopConfiguratorBuilder in project tbd-studio-se by Talend.
the class HadoopConfsUtils method getHadoopConfigurator.
public static HadoopConfigurator getHadoopConfigurator(HadoopConfigurationManager configurationManager, HadoopConfsConnection confsConnection) throws MalformedURLException {
HadoopConfiguratorBuilder configuratorBuilder = new HadoopConfiguratorBuilder().withVendor(configurationManager).withBaseURL(new URL(confsConnection.getConnURL())).withUsernamePassword(confsConnection.getUsername(), confsConnection.getPassword());
if (confsConnection.isUseAuth()) {
configuratorBuilder = configuratorBuilder.withTrustManagers(confsConnection.getTrustStoreFile(), confsConnection.getTrustStoreType(), confsConnection.getTrustStorePassword());
}
HadoopConfigurator configurator = configuratorBuilder.build();
return configurator;
}
Aggregations