Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python I';我无法使用代理配置使用PySpark_Python_Apache Spark_Pyspark_Proxy - Fatal编程技术网

Python I';我无法使用代理配置使用PySpark

Python I';我无法使用代理配置使用PySpark,python,apache-spark,pyspark,proxy,Python,Apache Spark,Pyspark,Proxy,我使用pyspark连接到一些需要通过代理配置访问的资源。为了使用代理配置进行身份验证,我尝试了几种方法,但我无法完成 如果我不使用Pyspark,它只会导出变量: SparkSession.builder.appName(app_name) \ .config("spark.executorEnv.HTTP_PROXY", <URL>) \ .config("spark.executorEnv.HTTPS_PROXY", <

我使用pyspark连接到一些需要通过代理配置访问的资源。为了使用代理配置进行身份验证,我尝试了几种方法,但我无法完成

如果我不使用Pyspark,它只会导出变量:

SparkSession.builder.appName(app_name) \
   .config("spark.executorEnv.HTTP_PROXY", <URL>) \
   .config("spark.executorEnv.HTTPS_PROXY", <URL>) \
   .config("spark.driverEnv.HTTP_PROXY", <URL>) \
   .config("spark.driverEnv.HTTPS_PROXY", <URL>) \
   .config("spark.yarAppMasterEnv.HTTP_PROXY", <URL>) \
   .config("spark.yarAppMasterEnv.HTTPS_PROXY", <URL>)
  • HTTP_代理
  • HTTPS\u代理
但对于Pyspark,我尝试了以下方法,但没有成功:

  • Spark上下文系统属性:

    SparkContext.setSystemProperty("http.proxyUser", <user>)
    SparkContext.setSystemProperty("http.proxyPassword", <pass>)
    SparkContext.setSystemProperty("http.proxyHost", <host>)
    SparkContext.setSystemProperty("http.proxyPort", <port>)
    SparkContext.setSystemProperty("jdk.http.auth.tunneling.disabledSchemes", "")
    SparkContext.setSystemProperty("jdk.http.auth.proxying.disabledSchemes", "")
    
    SparkContext.setSystemProperty(“http.proxyUser”,)
    SparkContext.setSystemProperty(“http.proxyPassword”,)
    SparkContext.setSystemProperty(“http.proxyHost”,)
    SparkContext.setSystemProperty(“http.proxyPort”,)
    SparkContext.setSystemProperty(“jdk.http.auth.tunneling.disabledSchemes”,”)
    SparkContext.setSystemProperty(“jdk.http.auth.proxying.disabledSchemes”,”)
    
  • SparkSession builder配置,环境变量:

    SparkSession.builder.appName(app_name) \
       .config("spark.executorEnv.HTTP_PROXY", <URL>) \
       .config("spark.executorEnv.HTTPS_PROXY", <URL>) \
       .config("spark.driverEnv.HTTP_PROXY", <URL>) \
       .config("spark.driverEnv.HTTPS_PROXY", <URL>) \
       .config("spark.yarAppMasterEnv.HTTP_PROXY", <URL>) \
       .config("spark.yarAppMasterEnv.HTTPS_PROXY", <URL>)
    
    SparkSession.builder.appName(app_name)\
    .config(“spark.executorEnv.HTTP_PROXY”,)\
    .config(“spark.executorEnv.HTTPS_PROXY”,)\
    .config(“spark.driverEnv.HTTP_PROXY”,)\
    .config(“spark.driverEnv.HTTPS_PROXY”,)\
    .config(“spark.yarAppMasterEnv.HTTP_PROXY”,)\
    .config(“spark.yarAppMasterEnv.HTTPS_PROXY”,)
    
  • SparkSession builder配置,extraJavaOption:

     SparkSession.builder.appName(app_name) \
        .config("spark.driver.extraClassPath", "-Dhttp.proxyUser=<user> -Dhttp.proxyPassword=<pass> -Dhttp.proxyHost=<host> -Dhttp.proxyPort=<port> -Dhttps.proxyUser=<user> -Dhttps.proxyPassword=<pass> -Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port> -Djdk.http.auth.tunneling.disabledSchemes= -Djdk.http.auth.proxying.disabledSchemes= )
    
    SparkSession.builder.appName(app_name)\
    .config(“spark.driver.extraClassPath”,“-Dhttp.proxyUser=-Dhttp.proxyPassword=-Dhttp.proxyHost=-Dhttp.proxyPort=-Dhttps.proxyUser=-Dhttps.proxyHost=-Dhttps.proxyPort=-Djdk.http.auth.tunneling.disabledSchemes=-djjjdk.http.auth.proxying.disablechemes=)
    
  • 方法1和3抛出错误“Proxy returns”HTTP/1.1407 Proxy Authentication Required”,我不知道为什么它不工作,因为我已经设置了user和password的值