2016-07-28 54 views
1

當我跟隨this example並嘗試使用內Cloudera的VM envirionrment命令​​,我不斷收到以下錯誤:無法在Cloudera的虛擬機上運行PySpark(不使用交互式shell)

ERROR spark.SparkContext: Error initializing SparkContext. 
org.apache.hadoop.security.AccessControlException: Permission denied: user=cloudera, access=WRITE, inode="/user/spark/applicationHistory":spark:supergroup:drwxr-xr-x 
.... 
Traceback (most recent call last): 
File "/home/cloudera/wordcount.py", line 9, in <module> 
sc = SparkContext(conf=conf) 
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/context.py", line 115, in __init__ 
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/context.py", line 172, in _do_init 
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/context.py", line 235, in _initialize_context 
File "/usr/lib/spark/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py", line 1064, in __call__ 
File "/usr/lib/spark/python/lib/py4j-0.9-src.zip/py4j/protocol.py", line 308, in get_return_value 
py4j.protocol.Py4JJavaError: An error occurred while calling None.org.apache.spark.api.java.JavaSparkContext. 
: org.apache.hadoop.security.AccessControlException: Permission denied: user=cloudera, access=WRITE, inode="/user/spark/applicationHistory":spark:supergroup:drwxr-xr-x 

我嘗試了這些兩個命令:

1,$ spark-submit --master yarn --deploy-mode client --executor-memory 1g \ --name wordcount --conf "spark.app.id=wordcount" wordcount.py hdfs://namenode_host:8020/path/to/inputfile.txt

2,$ spark-submit --master yarn --deploy-mode client --executor-memory 1g \ --name wordcount --conf "spark.app.id=wordcount" wordcount.py inputfile.txt

有人可以幫忙嗎?

+1

看起來你需要運行'chmod'或'chown'給用戶一些權限 –

+0

正如@ cricket_007提到的,它是一個權限問題。看起來Spark的'applicationHistory'沒有足夠的權限。你可以嘗試提供像這樣的權限 - 'sudo -u spark hadoop fs -chmod 777/user/spark/applicationHistory' – KartikKannapur

回答

0

嘗試使用以下環境變量在運行:

HADOOP_USER_NAME=hdfs spark-submit <your command> 
相關問題