Search in sources :

Example 1 with StandaloneHaServices

use of org.apache.flink.runtime.highavailability.nonha.standalone.StandaloneHaServices 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

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