如何在 Hortonworks VM 上的 Spark 上 运行 .jar?
How to run .jar on Spark on Hortonworks VM?
我是 Hortonworks VM 的新手,我很困惑。我正在尝试 运行 Spark 上的 .jar 文件。通常我通过 运行ning
在 Windows 上进行本地测试
spark-submit --driver-memory 4g --class en.name.ClassName %CODE%/target/program.jar
但是因为我需要 Hive,所以我想我应该转移到 Hortonworks VM 以在本地进行测试。现在,我已经通过 Hortonworks 的 Ambari 的 HDFS 文件 GUI 将我的 .jar 和输入文件上传到 HDFS(到 /tmp/my_code
目录)。接下来是什么?我也找到了命令行,但是如何从 VM 的命令行访问 HDFS 上的 .jar?我正在尝试 运行
spark-submit --driver-memory 4g --class en.name.ClassName /tmp/my_code/program.jar
来自沙盒吊顶(默认情况下 http://127.0.0.1:4200/
上的 运行ning,root@sandbox
"Shell in a Box"),它不起作用。它说 .jar 不存在。我如何指向 VM 使用 HDFS 上的 .jar?
谢谢!
JAR 应该在本地文件系统上,而不是在 hdfs
中。只有输入文件应该在 hdfs
中。所以 /tmp/my_code/program.jar
路径应该是本地路径,这就是为什么您会看到该错误:the .jar does not exists
如果你运行-这个命令:
>spark-submit --help
你会看到:
--jars JARS Comma-separated list of local jars to include on the driver
and executor classpaths.
更新:
根据 Documentations:
application-jar: Path to a bundled jar including your application and
all dependencies. The URL must be globally visible inside of your
cluster, for instance, an hdfs:// path or a file:// path that is
present on all nodes.
所以,
如果 jar 在 hdfs 上:
spark-submit --driver-memory 4g --class en.name.ClassName hdfs://target/program.jar
如果 jar 在本地:
spark-submit --driver-memory 4g --class en.name.ClassName /target/program.jar
或
spark-submit --driver-memory 4g --class en.name.ClassName file://target/program.jar
我是 Hortonworks VM 的新手,我很困惑。我正在尝试 运行 Spark 上的 .jar 文件。通常我通过 运行ning
在 Windows 上进行本地测试spark-submit --driver-memory 4g --class en.name.ClassName %CODE%/target/program.jar
但是因为我需要 Hive,所以我想我应该转移到 Hortonworks VM 以在本地进行测试。现在,我已经通过 Hortonworks 的 Ambari 的 HDFS 文件 GUI 将我的 .jar 和输入文件上传到 HDFS(到 /tmp/my_code
目录)。接下来是什么?我也找到了命令行,但是如何从 VM 的命令行访问 HDFS 上的 .jar?我正在尝试 运行
spark-submit --driver-memory 4g --class en.name.ClassName /tmp/my_code/program.jar
来自沙盒吊顶(默认情况下 http://127.0.0.1:4200/
上的 运行ning,root@sandbox
"Shell in a Box"),它不起作用。它说 .jar 不存在。我如何指向 VM 使用 HDFS 上的 .jar?
谢谢!
JAR 应该在本地文件系统上,而不是在 hdfs
中。只有输入文件应该在 hdfs
中。所以 /tmp/my_code/program.jar
路径应该是本地路径,这就是为什么您会看到该错误:the .jar does not exists
如果你运行-这个命令:
>spark-submit --help
你会看到:
--jars JARS Comma-separated list of local jars to include on the driver
and executor classpaths.
更新: 根据 Documentations:
application-jar: Path to a bundled jar including your application and all dependencies. The URL must be globally visible inside of your cluster, for instance, an hdfs:// path or a file:// path that is present on all nodes.
所以,
如果 jar 在 hdfs 上:
spark-submit --driver-memory 4g --class en.name.ClassName hdfs://target/program.jar
如果 jar 在本地:
spark-submit --driver-memory 4g --class en.name.ClassName /target/program.jar
或
spark-submit --driver-memory 4g --class en.name.ClassName file://target/program.jar