Search in sources :

Example 1 with HighAvailabilityMode

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.");
    }
}
Also used : HighAvailabilityMode(org.apache.flink.runtime.jobmanager.HighAvailabilityMode) ZooKeeperUtilityFactory(org.apache.flink.runtime.zookeeper.ZooKeeperUtilityFactory)

Example 2 with HighAvailabilityMode

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);
    }
}
Also used : HighAvailabilityMode(org.apache.flink.runtime.jobmanager.HighAvailabilityMode) IllegalConfigurationException(org.apache.flink.configuration.IllegalConfigurationException)

Example 3 with HighAvailabilityMode

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);
    }
}
Also used : HighAvailabilityMode(org.apache.flink.runtime.jobmanager.HighAvailabilityMode) IllegalConfigurationException(org.apache.flink.configuration.IllegalConfigurationException)

Example 4 with HighAvailabilityMode

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.");
    }
}
Also used : HighAvailabilityMode(org.apache.flink.runtime.jobmanager.HighAvailabilityMode) StandaloneHaServices(org.apache.flink.runtime.highavailability.nonha.standalone.StandaloneHaServices) FlinkException(org.apache.flink.util.FlinkException) IllegalConfigurationException(org.apache.flink.configuration.IllegalConfigurationException) ConfigurationException(org.apache.flink.util.ConfigurationException) UnknownHostException(java.net.UnknownHostException)

Aggregations

HighAvailabilityMode (org.apache.flink.runtime.jobmanager.HighAvailabilityMode)4 IllegalConfigurationException (org.apache.flink.configuration.IllegalConfigurationException)3 UnknownHostException (java.net.UnknownHostException)1 StandaloneHaServices (org.apache.flink.runtime.highavailability.nonha.standalone.StandaloneHaServices)1 ZooKeeperUtilityFactory (org.apache.flink.runtime.zookeeper.ZooKeeperUtilityFactory)1 ConfigurationException (org.apache.flink.util.ConfigurationException)1 FlinkException (org.apache.flink.util.FlinkException)1