use of org.apache.flink.runtime.jobmanager.HighAvailabilityMode in project flink by apache.
the class MesosServicesUtils method createMesosServices.
/**
* Creates a {@link MesosServices} instance depending on the high availability settings.
*
* @param configuration containing the high availability settings
* @return a mesos services instance
* @throws Exception if the mesos services instance could not be created
*/
public static MesosServices createMesosServices(Configuration configuration) throws Exception {
HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration);
switch(highAvailabilityMode) {
case NONE:
return new StandaloneMesosServices();
case ZOOKEEPER:
final String zkMesosRootPath = ConfigurationUtil.getStringWithDeprecatedKeys(configuration, ConfigConstants.HA_ZOOKEEPER_MESOS_WORKERS_PATH, ConfigConstants.DEFAULT_ZOOKEEPER_MESOS_WORKERS_PATH, ConfigConstants.ZOOKEEPER_MESOS_WORKERS_PATH);
ZooKeeperUtilityFactory zooKeeperUtilityFactory = new ZooKeeperUtilityFactory(configuration, zkMesosRootPath);
return new ZooKeeperMesosServices(zooKeeperUtilityFactory);
default:
throw new Exception("High availability mode " + highAvailabilityMode + " is not supported.");
}
}
use of org.apache.flink.runtime.jobmanager.HighAvailabilityMode in project flink by apache.
the class YarnHighAvailabilityServices method forYarnTaskManager.
/**
* Creates the high-availability services for the TaskManagers participating in
* a Flink YARN application.
*
* @param flinkConfig The Flink configuration.
* @param hadoopConfig The Hadoop configuration for the YARN cluster.
*
* @return The created high-availability services.
*
* @throws IOException Thrown, if the high-availability services could not be initialized.
*/
public static YarnHighAvailabilityServices forYarnTaskManager(Configuration flinkConfig, org.apache.hadoop.conf.Configuration hadoopConfig) throws IOException {
checkNotNull(flinkConfig, "flinkConfig");
checkNotNull(hadoopConfig, "hadoopConfig");
final HighAvailabilityMode mode = HighAvailabilityMode.fromConfig(flinkConfig);
switch(mode) {
case NONE:
return new YarnPreConfiguredMasterNonHaServices(flinkConfig, hadoopConfig);
case ZOOKEEPER:
throw new UnsupportedOperationException("to be implemented");
default:
throw new IllegalConfigurationException("Unrecognized high availability mode: " + mode);
}
}
use of org.apache.flink.runtime.jobmanager.HighAvailabilityMode in project flink by apache.
the class YarnHighAvailabilityServices method forSingleJobAppMaster.
// ------------------------------------------------------------------------
// Factory from Configuration
// ------------------------------------------------------------------------
/**
* Creates the high-availability services for a single-job Flink YARN application, to be
* used in the Application Master that runs both ResourceManager and JobManager.
*
* @param flinkConfig The Flink configuration.
* @param hadoopConfig The Hadoop configuration for the YARN cluster.
*
* @return The created high-availability services.
*
* @throws IOException Thrown, if the high-availability services could not be initialized.
*/
public static YarnHighAvailabilityServices forSingleJobAppMaster(Configuration flinkConfig, org.apache.hadoop.conf.Configuration hadoopConfig) throws IOException {
checkNotNull(flinkConfig, "flinkConfig");
checkNotNull(hadoopConfig, "hadoopConfig");
final HighAvailabilityMode mode = HighAvailabilityMode.fromConfig(flinkConfig);
switch(mode) {
case NONE:
return new YarnIntraNonHaMasterServices(flinkConfig, hadoopConfig);
case ZOOKEEPER:
throw new UnsupportedOperationException("to be implemented");
default:
throw new IllegalConfigurationException("Unrecognized high availability mode: " + mode);
}
}
use of org.apache.flink.runtime.jobmanager.HighAvailabilityMode in project flink by apache.
the class HighAvailabilityServicesUtils method createHighAvailabilityServices.
public static HighAvailabilityServices createHighAvailabilityServices(Configuration configuration, Executor executor, AddressResolution addressResolution, RpcSystemUtils rpcSystemUtils, FatalErrorHandler fatalErrorHandler) throws Exception {
HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration);
switch(highAvailabilityMode) {
case NONE:
final Tuple2<String, Integer> hostnamePort = getJobManagerAddress(configuration);
final String resourceManagerRpcUrl = rpcSystemUtils.getRpcUrl(hostnamePort.f0, hostnamePort.f1, RpcServiceUtils.createWildcardName(ResourceManager.RESOURCE_MANAGER_NAME), addressResolution, configuration);
final String dispatcherRpcUrl = rpcSystemUtils.getRpcUrl(hostnamePort.f0, hostnamePort.f1, RpcServiceUtils.createWildcardName(Dispatcher.DISPATCHER_NAME), addressResolution, configuration);
final String webMonitorAddress = getWebMonitorAddress(configuration, addressResolution);
return new StandaloneHaServices(resourceManagerRpcUrl, dispatcherRpcUrl, webMonitorAddress);
case ZOOKEEPER:
return createZooKeeperHaServices(configuration, executor, fatalErrorHandler);
case FACTORY_CLASS:
return createCustomHAServices(configuration, executor);
default:
throw new Exception("Recovery mode " + highAvailabilityMode + " is not supported.");
}
}
Aggregations