【发布时间】:2019-08-15 09:43:14
【问题描述】:
我正在尝试在 Ubuntu 上设置 Apache Spark 并输出 hello world。
我将这两行添加到 .bashrc 中
export SPARK_HOME=/home/james/spark
export PATH=$PATH:$SPARK_HOME/bin
(其中 spark 是我拥有的当前 spark 版本的符号链接)。 我跑
spark-shell
从命令行和 shell 启动时出现数百个错误,例如:
Caused by: javax.jdo.JDOFatalDataStoreException: Unable to open a test
connection to the given database. JDBC url = jdbc:derby:;databaseName=metastore_db;create=true, username = APP. Terminating connection pool (set lazyInit to true if you expect to start your database after your app)
Caused by: ERROR XJ041: Failed to create database 'metastore_db', see the next exception for details.
Caused by: ERROR XBM0A: The database directory '/home/james/metastore_db' exists. However, it does not contain the expected 'service.properties' file. Perhaps Derby was brought down in the middle of creating this database. You may want to delete this directory and try creating the database again.
Caused by: java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:derby:;databaseName=metastore_db;create=true, username = APP.
Caused by: org.apache.derby.iapi.error.StandardException: Failed to create database 'metastore_db', see the next exception for details.
我的 Java 版本:
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
我尝试用 scala 打开一个简单的文本文件:
scala> val textFile = sc.TextFile("test/README.md")
<console>:17: error: not found: value sc
我读到我需要创建一个新的 SparkContext。所以我试试这个:
scala> sc = SparkContext(appName = "foo")
<console>:19: error: not found: value sc
val $ires1 = sc
^
<console>:17: error: not found: value sc
sc = SparkContext(appName = "foo")
还有这个:
scala> val sc = new SparkContext(conf)
<console>:17: error: not found: type SparkContext
val sc = new SparkContext(conf)
^
<console>:17: error: not found: value conf
val sc = new SparkContext(conf)
我不知道发生了什么。我所需要的只是正确的设置,那么应该没有问题。 提前谢谢你。
【问题讨论】:
-
谢谢。我设法重新安装并使用了旧版本,它工作正常。
标签: apache-spark apache-spark-ml