Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive, mail # user - Mysql metastore configuration error.


Copy link to this message
-
Re: Mysql metastore configuration error.
Stephen Boesch 2011-11-22, 07:01
Was that code above  *verbatim? *
because there is a typo

Hive> Load *s*ata local inpath ‘path/to/abcd.txt’ into table abcd;

(load sata not load data)

2011/11/21 Aditya Singh30 <[EMAIL PROTECTED]>

> Hi Everybody,****
>
>                                 I am using Apache’s Hadoop-0.20.2 and
> Apache’s Hive-0.7.0. I have a 2 node cluster. One Redhat Linux 6.0(Hadoop
> Server) and other Windows 7 using Cygwin. The Hadoop cluster is working
> fine. I have checked by executing various examples provided with Hadoop.
> Map reduce jobs are being executed fine. For Hive I am using MySQL for
> metastore with following configuration is hive-site.xml :****
>
> ** **
>
> <property>   ****
>
> <name>javax.jdo.option.ConnectionURL</name>   ****
>
> <value>jdbc:mysql://localhost:3306/metastore?createDatabaseIfNotExist=true</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>hiveuser</value> ****
>
> </property>   ****
>
> ** **
>
> <property> ****
>
>   <name>datanucleus.autoCreateSchema</name> ****
>
>   <value>false</value> ****
>
> </property> ****
>
>   ****
>
> <property> ****
>
>   <name>datanucleus.fixedDatastore</name> ****
>
>   <value>true</value> ****
>
> </property>****
>
> ** **
>
> ** **
>
> I created the DB and hiveuser in mysql using following commands:****
>
> mysql> CREATE DATABASE metastore; ****
>
> mysql> USE metastore; ****
>
> mysql> SOURCE
> /usr/local/hive/scripts/metastore/upgrade/mysql/hive-schema-0.7.0.mysql.sql;
> ****
>
> ** **
>
> mysql> CREATE USER 'hiveuser'@'%' IDENTIFIED BY 'hiveuser'; ****
>
> mysql> GRANT ALL ON metastore.* TO 'hiveuser'@'%'; ****
>
> ** **
>
> I created a table using the following command on hive:****
>
> hive> Create table abcd(ab int, cd string) row format delimited fields
> terminated by ‘#’ stored as textfile;****
>
> ** **
>
> Then I created a file abcddata.txt containing the following data****
>
> 11#aa****
>
> 22#bb****
>
> 33#cc****
>
> ** **
>
> Then I loaded this data into table abcd using :****
>
> Hive> Load sata local inpath ‘path/to/abcd.txt’ into table abcd;****
>
> ** **
>
> Now when I execute “select * from abcd” it runs successfully and shows
> the data in abcd. ****
>
> But if I run “select ab from abcd” or “ select * from abcd where cd=’aa’”
> it returns error: ****
>
> ** **
>
> FAILED: Execution Error, return code 2 from
> org.apache.hadoop.hive.ql.exec.MapRedTask****
>
> ** **
>
> In the logs I found:****
>
> Caused by: java.util.NoSuchElementException****
>
>         at java.util.Vector.lastElement(Vector.java:456)****
>
>         at com.sun.beans.ObjectHandler.lastExp(ObjectHandler.java:134)****
>
>         at
> com.sun.beans.ObjectHandler.dequeueResult(ObjectHandler.java:138)****
>
>         at java.beans.XMLDecoder.readObject(XMLDecoder.java:201)****
>
>         at
> org.apache.hadoop.hive.ql.exec.Utilities.deserializeMapRedWork(Utilities.java:462)
> ****
>
>         at
> org.apache.hadoop.hive.ql.exec.Utilities.getMapRedWork(Utilities.java:184)
> ****
>
> ** **
>
> ** **
>
> And when I tried to access Hive from a java program using connection
> string:****
>
> (jdbc:mysql://master:3306/metastore","hiveuser","hiveuser")****
>
> Running command “describe abcd” it returns:****
>
> Exception in thread "main"
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table
> 'metastore.abcd' doesn't exist****
>
> ** **
>
> Then on the mysql server I ran:****
>
> mysql> use metastore;****
>
> mysql> show tables;****
>
> ** **
>
> The table abcd is not there. The table is not being stored in the mysql
> metastore db. ****
>
> So how come on Hive CLI, when I do “select * from abcd” it shows the data