Built-Hive
- The required core-site.xml hdfs-site.xml and copied to the spark conf directory. If you find metastore_db under Spark path, you need to delete [ when only the first start ].
- When you first start to create metastore, you need to specify spark.sql.warehouse.dir this parameter,
spark-shell --master spark://hadoop01:7077 --conf spark.sql.warehouse.dir=hdfs://hadoop01:9000/spark_warehouse
Just create a table
scala> spark.sql("create table test(id bigint,name string)")
Results are as follows, hadoop cluster on when you can see where this table
External Hive
- The hive-site.xml need to copy the spark conf directory.
- If a hive of metestore use the mysql database, you will need the mysql jdbc driver package into the directory under jars of spark.
- Sql queries can be performed by spark-sql or spark-shell. Complete and hive connection.