[英]Files not getting saved in Azure blob using Spark in HDInsights cluster
我們已經在 Azure 上設置了 HDInsights 群集,並使用 Blob 作為 Hadoop 的存儲。 我們嘗試使用 hadoop CLI 將文件上傳到 Hadoop,並且文件正在上傳到 Azure Blob。
用於上傳的命令:
hadoop fs -put somefile /testlocation
但是,當我們嘗試使用 Spark 將文件寫入 Hadoop 時,它並沒有上傳到 Azure Blob 存儲,而是上傳到了數據節點的hdfs-site.xml
中指定的目錄中的 VM 磁盤
使用的代碼:
df1mparquet = spark.read.parquet("hdfs://hostname:8020/dataSet/parquet/")
df1mparquet .write.parquet("hdfs://hostname:8020/dataSet/newlocation/")
奇怪的行為:
當我們運行時:
hadoop fs -ls / => It lists the files from Azure Blob storage
hadoop fs -ls hdfs://hostname:8020/ => It lists the files from local storage
這是預期的行為嗎?
您需要查看core-site.xml
中fs.defaultFS
的值。
聽起來默認文件系統是 blob 存儲。
https://hadoop.apache.org/docs/current/hadoop-azure/index.html
關於 Spark,如果它加載與 CLI 相同的 hadoop 配置,則不需要指定 namenode 主機/端口,只需使用文件路徑,它也將默認為 blob 存儲。
如果您為不同的文件系統指定完整的 URI,那么它將使用它,但hdfs://
應該不同於實際的本地file://
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.