Database Reference
In-Depth Information
For the Hive import, you need to add an extra line to the option file: --hive-import (line 10). Once the data is
loaded onto HDFS, the new line will cause it to be loaded into Hive, this time to a table named to match its source:
1 import
2 --connect
3 jdbc:mysql://hc1nn/sqoop
4 --username
5 sqoop
6 --password
7 xxxxxxxxxxxx
8 --table
9 rawdata
10 --hive-import
The Sqoop command to import remains the same—only the contents of the options file change. The data will be
loaded into Hive, and the table in Hive will be named the same as its source table in MySQL, as follows:
sqoop --options-file ./hive-import.txt --table sqoop.rawdata -m 1
Also, before you run the Sqoop command, you should be aware of some potential errors that can occur.
For example, if the Hive Metastore server (the server that manages metadata for Hive) is not running, you will receive
the following error:
14/07/20 11:45:44 INFO hive.HiveImport: org.apache.hadoop.hive.ql.metadata.HiveException:
java.lang.RuntimeException:
Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
As the Linux root user, you can check the state of the Hive Metastore server by using the following command:
[root@hc1nn conf]# service hive-metastore status
Hive Metastore is dead and pid file exists [FAILED]
Errors also can occur when the server cannot access the Derby database for read/write, as this error from the
/var/log/hive/ hive-metastore.log shows:
2014-07-20 09:20:58,148 ERROR Datastore.Schema (Log4JLogger.java:error(125)) - Failed initialising
database.
Cannot get a connection, pool error Could not create a validated object, cause: A read-only user
or a user in a read-only database is not permitted to disable read-only mode on a connection.
org.datanucleus.exceptions.NucleusDataStoreException: Cannot get a connection, pool error Could
not create a validated object, cause: A read-only user or a user in a read-only database is not
permitted to disable read-only mode on a connection.
If you encounter read/write errors to the Hive Derby database, you can fix them by updating each Hive instance's
hive-site.xml file under /etc/hive/conf to add the following:
<property>
<name>hive.metastore.uris</name>
<value>thrift://hc1nn:9083</value>
<description>
IP address (or fully-qualified domain name) and port of the metastore host
</description>
</property>
Search WWH ::




Custom Search