回答

4

我提交這裏的解決方案,我想出了通過組合不同的資源:

  1. 下載谷歌的雲存儲連接器:gs-connector並將其存儲在$SPARK/jars/文件夾(檢查替代1在底部)

  2. here下載core-site.xml文件,或者從下面複製文件。這是hadoop使用的配置文件,(由spark使用)。

  3. core-site.xml文件存儲在一個文件夾中。我個人創建$SPARK/conf/hadoop/conf/文件夾並將其存儲在那裏。

  4. 在spark-env.sh文件中加入下面一行表示的Hadoop的conf fodler:export HADOOP_CONF_DIR= =</absolute/path/to/hadoop/conf/>

  5. 創建一個從谷歌的相應頁面(Google Console-> API-Manager-> Credentials)OAuth2用戶密鑰。

  6. 將憑據複製到core-site.xml文件。

選擇1:相反,將文件複製到該文件夾​​$SPARK/jars的,你可以在罐子存放任何文件夾中,並在類路徑火花添加文件夾。一種方法是在spark-env.sh``folder but中編輯SPARK_CLASSPATH SPARK_CLASSPATH`現已被棄用。因此,你可以看看here如何在火花類路徑中添加一個罐子

<configuration> 
    <property> 
     <name>fs.gs.impl</name> 
     <value>com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem</value> 
     <description>Register GCS Hadoop filesystem</description> 
    </property> 
    <property> 
     <name>fs.gs.auth.service.account.enable</name> 
     <value>false</value> 
     <description>Force OAuth2 flow</description> 
    </property> 
    <property> 
     <name>fs.gs.auth.client.id</name> 
     <value>32555940559.apps.googleusercontent.com</value> 
     <description>Client id of Google-managed project associated with the Cloud SDK</description> 
    </property> 
    <property> 
     <name>fs.gs.auth.client.secret</name> 
     <value>fslkfjlsdfj098ejkjhsdf</value> 
     <description>Client secret of Google-managed project associated with the Cloud SDK</description> 
    </property> 
    <property> 
     <name>fs.gs.project.id</name> 
     <value>_THIS_VALUE_DOES_NOT_MATTER_</value> 
     <description>This value is required by GCS connector, but not used in the tools provided here. 
    The value provided is actually an invalid project id (starts with `_`). 
     </description> 
    </property> 
</configuration> 
相關問題