我试图运行本地jar文件与火花提交,这是非常好的工作。这是命令-
spark-submit --class "SimpleApp" --master local myProject/target/scala-2.11/simple-project_2.11-1.0.jar
但当我试着卷发
curl -X POST --data '{
"file": "file:///home/user/myProject/target/scala-2.11/simple-project_2.11-1.0.jar",
"className": "SimpleApp",
}'
-H
"Content-Type: application/json"
http://server:8998/batches
这是抛错
"requirement failed: Local path /home/user/myProject/target/scala-2.11/simple-project_2.11-1.0.jar cannot be added to user sessions."
这是我的livy.conf文件,正如一些文章所建议的那样,可以更改一些东西。
# What host address to start the server on. By default, Livy will bind to all network interfaces.
livy.server.host = 0.0.0.0
# What port to start the server on.
livy.server.port = 8998
# What spark master Livy sessions should use.
livy.spark.master = local
# What spark deploy mode Livy sessions should use.
livy.spark.deploy-mode = client
# List of local directories from where files are allowed to be added to user sessions. By
# default it's empty, meaning users can only reference remote URIs when starting their
# sessions.
livy.file.local-dir-whitelist= /home/user/.livy-sessions/
请帮我解决这个问题。
提前谢谢。
发布于 2018-06-29 22:06:41
最近,我从Apache获得了本地文件读取的解决方案,因为我使用cURL创建了错误的请求。我刚刚将'file://‘’中的文件读取协议替换为'local:/‘,这对我是有效的。
curl -X POST --data '{
"file": "local:/home/user/myProject/target/scala-2.11/simple-project_2.11-1.0.jar",
"className": "SimpleApp",
}'
-H
"Content-Type: application/json"
http://server:8998/batches
这是一个相当小的错误,但我的jar文件仍然不能从HDFS访问。
谢谢大家的帮助。
发布于 2018-06-26 01:18:22
Apache Livy
jar文件的存在是必需的。如果没有相应的jar文件,它就无法工作。
下面是我的建议:只需将livy jar
文件追加到使用java's cp option
的类路径
java -cp /usr/local/livy.jar com.myclass.Main
或者简单地使用SBT:
libraryDependencies += "org.apache.livy" % "livy-api" % "0.4.0-incubating"
Maven:
<dependency>
<groupId>org.apache.livy</groupId>
<artifactId>livy-api</artifactId>
<version>0.4.0-incubating</version>
</dependency>
或者你最喜欢的构建工具。
顺便说一句,您还可以将livy jar
文件上传到HDFS
,并在您的Hadoop集群上使用它,这样可以大大简化您的生活。
发布于 2019-05-22 22:37:09
下面的答案对我有用,正如在这里所说的,Apache Livy cURL not working for spark-submit command
要为livy批处理作业使用本地文件,您需要将本地文件夹添加到livy.conf中的livy.file.local-dir-whitelist属性中。
来自livy.conf.template的描述:
允许将文件添加到用户会话的本地目录列表。默认情况下,它是空的,这意味着用户只能在启动会话时引用远程URI。
https://stackoverflow.com/questions/51038328
复制相似问题