Class ConfigurationFileMigrationUtils


  • public class ConfigurationFileMigrationUtils
    extends Object
    Utility class for migrating legacy Flink configuration file flink-conf.yaml to the new format starting from Flink 2.0. This class provides methods to load legacy configuration files and convert them into the new configuration format.
    • Field Detail

      • LEGACY_FLINK_CONF_FILENAME

        @VisibleForTesting
        public static final String LEGACY_FLINK_CONF_FILENAME
        This file is only used to help users migrate their legacy configuration files to the new configuration file `config.yaml` starting from Flink 2.0.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ConfigurationFileMigrationUtils

        public ConfigurationFileMigrationUtils()
    • Method Detail

      • migrateLegacyToStandardYamlConfig

        public static Configuration migrateLegacyToStandardYamlConfig​(String configDir)
        Migrates the legacy Flink configuration from the specified directory to a standard YAML format representation.

        This method loads the legacy configuration file named flink-conf.yaml from the specified directory. If the file is found, it converts the legacy format into a standard Configuration object in YAML format.

        Parameters:
        configDir - the directory where the legacy configuration file is located
        Returns:
        a Configuration object in standard YAML format
      • loadLegacyYAMLResource

        @VisibleForTesting
        public static Map<String,​String> loadLegacyYAMLResource​(File file)
        Loads a YAML-file of key-value pairs.

        Colon and whitespace ": " separate key and value (one per line). The hash tag "#" starts a single-line comment.

        Example:

         jobmanager.rpc.address: localhost # network address for communication with the job manager
         jobmanager.rpc.port   : 6123      # network port to connect to for communication with the job manager
         taskmanager.rpc.port  : 6122      # network port the task manager expects incoming IPC connections
         

        This does not span the whole YAML specification, but only the *syntax* of simple YAML key-value pairs (see issue #113 on GitHub). If at any point in time, there is a need to go beyond simple key-value pairs syntax compatibility will allow to introduce a YAML parser library.

        Parameters:
        file - the YAML file to read from
        See Also:
        YAML 1.2 specification