Impala找不到com.mysql.jdbc.Driver

时间:2013-06-18 15:51:29

标签: hadoop hive cloudera impala

我正在尝试在Red Hat 5上以伪分布式模式使用CDH4设置Cloudera Impala。我使用JDBC连接到MySQL Metastore的Hive,但是我在使用JDBC设置Impala时遇到了麻烦。我一直在按照此处的说明操作:http://www.cloudera.com/content/cloudera-content/cloudera-docs/Impala/latest/Installing-and-Using-Impala/ciiu_impala_jdbc.html

我已将JAR解压缩到一个目录,并将该目录包含在$CLASSPATH中。我还在/usr/lib/hive/lib中添加了$CLASSPATH,其中包含mysql-connector-java-5.1.25-bin.jar

在我的Hive和Impala conf目录中,我有hive-site.xml包含以下属性:

<property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://localhost/metastore</value>
</property>

<property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.jdbc.Driver</value>
</property>

<property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>hiveuser</value>
</property>

<property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>password</value>
</property>

<property>
    <name>datanucleus.autoCreateSchema</name>
    <value>false</value>
</property>

<property>
    <name>datanucleus.fixedDatastore</name>
    <value>true</value>
</property>

但是当我运行sudo service impala-server restart时,服务器日志出现此错误:

ERROR common.MetaStoreClientPool: Error initializing Hive Meta Store client
javax.jdo.JDOFatalInternalException: Error creating transactional connection factory

它说的原因是:

Caused by: org.datanucleus.store.rdbms.datasource.DatastoreDriverNotFoundException: The specified datastore driver ("com.mysql.jdbc.Driver") was not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver.
    at org.datanucleus.store.rdbms.datasource.dbcp.DBCPDataSourceFactory.makePooledDataSource(DBCPDataSourceFactory.java:80)
    at org.datanucleus.store.rdbms.ConnectionFactoryImpl.initDataSourceTx(ConnectionFactoryImpl.java:144)
    ... 57 more

我是否缺少使用JDBC配置Impala的步骤?

1 个答案:

答案 0 :(得分:5)

我通过将mysql-connector-java-5.1.25-bin.jar复制到/var/lib/impala来解决此问题 - 启动脚本由于某种原因告诉类路径在这里查找连接器jar。