Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

HDP 2.6 Spark can't create database - configuration issue?

avatar
New Member

Hi,

After installing HDP 2.6.3, I ran Pyspark in the terminal, then initiated a Spark Session, and tried to create a new database (see last line of code:

$ pyspark
> from pyspark.sql import SparkSession
> spark = SparkSession.builder.master("local").appName("test").enableHiveSupport().getOrCreate()
> spark.sql("show databases").show()
> spark.sql("create database if not exists NEW_DB")

However, PySpark threw an error where it was trying to create a database locally:

AnalysisException: 'org.apache.hadoop.hive.ql.metadata.HiveException: MetaException(message:Unable to create database path file:/home/jdoe/spark-warehouse/new_db.db, failed to create database new_db);'

I wasn't trying to create a database locally. I was trying to create a database within Hive. Is there a configuration problem with HDP 2.6.3?

Please advise. Thanks.

1 ACCEPTED SOLUTION

avatar

@John Doe Could you try running on yarn client mode instead of local? I think this will help resolving the problem you have now.

$ pyspark --master yarn
from pyspark.sql import SparkSession
spark =SparkSession.builder.appName("test").enableHiveSupport().getOrCreate()
spark.sql("show databases").show()
spark.sql("create database if not exists NEW_DB")

Note: If you comment this post make sure you tag my name. And If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.

HTH

View solution in original post

12 REPLIES 12

avatar
New Member

@Felix Albani,

Felix Albani

I would be glad to mark the answer as helpful, but don't know how to do that.

avatar

@John Doe When you like to accept an answer you should look for this

74490-screen-shot-2018-05-18-at-123315-pm.png

Then Accept

HTH

avatar
New Member

@Felix Albani

I would be glad to mark the answer as helpful, but don't know how to do that.