hadoop Spark读取/写入Azure blob存储-IOException:方案没有文件系统:瓦斯布

abithluo  于 2023-03-07  发布在  Hadoop
关注(0)|答案(1)|浏览(127)

我正在尝试读取/写入Azure blob存储,但不断收到“方案没有文件系统:wasbs”。下面是我的gradle文件的外观

plugins {
    // Apply the scala plugin to add support for Scala
    id 'scala'
    id 'idea'
    id 'application'
}

repositories {
    mavenLocal()
    jcenter()

    maven {
        url "https://repository.mulesoft.org/nexus/content/repositories/public"
    }
}

dependencies {
    // Spark SQL subsumes Spark Core
    compileOnly 'org.apache.spark:spark-sql_2.12:3.0.3'
    implementation group: 'org.scala-lang', name: 'scala-library', version: '2.12.1'

    implementation group: 'com.typesafe', name: 'config', version: '1.4.1'
    implementation group: 'com.microsoft.azure', name: 'azure-storage', version: '8.6.6'
    implementation group: 'org.apache.hadoop', name: 'hadoop-azure', version: '3.3.1'
}

jar {
    manifest {
        attributes('Main-Class': 'AppRunner')
    }
    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
    exclude 'META-INF/*.RSA'
    exclude 'META-INF/*.SF'
    exclude 'META-INF/*.DSA'

    duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}

我正在创建一个jar文件,其中包含hadoop-azure和azure-storage所需的所有依赖项。
这就是我的Scala文件主要做的事情。

spark.conf.set("fs.azure.account.key.<blob-name>.blob.core.windows.net", "<blob-key>")
spark.sparkContext.hadoopConfiguration.set("fs.azure", "org.apache.hadoop.fs.azure.NativeAzureFileSystem")

val df = spark.read.parquet("wasbs://<container-name>@<blob-name>.blob.core.windows.net/data/")

我的Spark安装程序目前位于Azure环境中的一个VM上,我在该环境中以独立模式运行Spark 3.1.2。
我的spark-submit命令如下所示
./spark-3.1.2-bin-hadoop2.7/bin/spark-submit --master "local[*]" --jars jars/hadoop-azure-3.3.1.jar,jars/azure-storage-8.6.6.jar compiled-job.jar
我不需要包含jar作为参数,但我包含它是为了测试,因为Spark作业似乎无法主要找到wasbs文件系统。
下面是我在运行jar文件时收到的异常

Exception in thread "main" java.io.IOException: No FileSystem for scheme: wasbs
    at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2660)
    at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2667)
    at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:94)
    at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2703)
    at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2685)

你知道我做错了什么吗?

uqxowvwt

uqxowvwt1#

只需添加此配置:设置(“文件系统.wasbs.impl”、“组织.apache.hadoop.文件系统.azure.本机azureFileSystem”)

相关问题