Spark 配置连接hive 元数据库(mysql)
Spark 连接hive 元数据库(mysql) 方法一: 1)打开Hive metastore [root@head42 ~]# hive --service metastore & netstat -ano|grep 9083 ??? 2)开启spark连接Mysql [root@head42 ~]# spark-shell --conf spark.hadoop.hive.metastore.uris=thrift://localhost:9083 3)scala> spark.sql("show tables").show spark.sql("select * from database_name.table_name")//访问其他数据库 +--------+--------------+-----------+ |database| tableName|isTemporary| +--------+--------------+-----------+ | default| customer| false| | default|text_customers| false| +--------+--------------+-----------+ 这样就Ok了! 方法二: 1)拷贝hive的hive-site.xml文件到spark的conf目录下 2