2014-11-20 2 views
2

하이브 및 MySQL 백업 메타 데이터로 아파치 스파크를 구성하려고합니다. 나는 다음과 같은 명령을 다음스파크 및 MySQL 메타 데이터로 하이브

bin/spark-shell --jars /usr/share/java/mysql-connector-java.jar 

와 함께 불꽃 쉘을 시작 할 수 있었다 다음과 같은 예외

Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://<correct-information> 

을 얻고 그 다음 나는 다음과 같은 명령을

scala> Class.forName("com.mysql.jdbc.Driver") 
res0: Class[_] = class com.mysql.jdbc.Driver 

scala> new org.apache.spark.sql.hive.HiveContext(sc).sql("select * from table limit 1").first 

예외를 실행 I 거대하다.하지만 여기가 바로 위에있다.

Unable to open a test connection to the given database. JDBC url = jdbc:mysql://<hostname>/metastore, username = hiveuser. Terminating connection pool. Original Exception: ------ 
java.sql.SQLException: No suitable driver found for jdbc:mysql://<hostname>/metastore 

이 간단한 쿼리는 하이브 명령 줄에서 올바르게 실행됩니다. 첫 번째 spark 명령은 mysql JDBC 드라이버가 클래스 경로에 있음을 보여 주지만 여전히 찾을 수는 없다고합니다. 누구든지 아이디어가 있습니까?

감사

답변

3

그것은 올바른 스파크 플래그가 --driver 클래스 경로

+1

것으로 밝혀 내가 경로를 기억하지 않아도 스파크 설정 영역에이 빵을 할 수있는 방법이 있나요 내가 스파크 - SQL을 시작할 때마다? – chrisinmtown

+0

'conf/spark-defaults.conf'에서 설정할 수있는'spark.driver.extraClassPath'가 있습니다 – karlson

관련 문제