Search in sources :

Example 1 with FileSystemBlobStore

use of org.apache.flink.runtime.blob.FileSystemBlobStore in project flink by apache.

the class ZookeeperHaServices method createBlobStore.

/**
	 * Creates the BLOB store in which BLOBs are stored in a highly-available
	 * fashion.
	 *
	 * @param configuration configuration to extract the storage path from
	 * @return Blob store
	 * @throws IOException if the blob store could not be created
	 */
public static BlobStore createBlobStore(final Configuration configuration) throws IOException {
    String storagePath = configuration.getValue(HighAvailabilityOptions.HA_STORAGE_PATH);
    if (isNullOrWhitespaceOnly(storagePath)) {
        throw new IllegalConfigurationException("Configuration is missing the mandatory parameter: " + HighAvailabilityOptions.HA_STORAGE_PATH);
    }
    final Path path;
    try {
        path = new Path(storagePath);
    } catch (Exception e) {
        throw new IOException("Invalid path for highly available storage (" + HighAvailabilityOptions.HA_STORAGE_PATH.key() + ')', e);
    }
    final FileSystem fileSystem;
    try {
        fileSystem = path.getFileSystem();
    } catch (Exception e) {
        throw new IOException("Could not create FileSystem for highly available storage (" + HighAvailabilityOptions.HA_STORAGE_PATH.key() + ')', e);
    }
    final String clusterId = configuration.getValue(HighAvailabilityOptions.HA_CLUSTER_ID);
    storagePath += "/" + clusterId;
    return new FileSystemBlobStore(fileSystem, storagePath);
}
Also used : Path(org.apache.flink.core.fs.Path) FileSystemBlobStore(org.apache.flink.runtime.blob.FileSystemBlobStore) FileSystem(org.apache.flink.core.fs.FileSystem) IllegalConfigurationException(org.apache.flink.configuration.IllegalConfigurationException) IOException(java.io.IOException) IllegalConfigurationException(org.apache.flink.configuration.IllegalConfigurationException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 IllegalConfigurationException (org.apache.flink.configuration.IllegalConfigurationException)1 FileSystem (org.apache.flink.core.fs.FileSystem)1 Path (org.apache.flink.core.fs.Path)1 FileSystemBlobStore (org.apache.flink.runtime.blob.FileSystemBlobStore)1