[Big Data learning --hive] hive executed in select * from tablename error problem.

After the build hive in a virtual machine, create a table, in the implementation of select * from tablename time error, the specific error message is as follows:

hive> select * from hive_01;
FAILED: SemanticException Unable to determine if hdfs://master:9000/user/hive/warehouse/hive_1.db/hive_01 is encrypted: java.lang.IllegalArgumentException: java.net.UnknownHostException: master

Roughly meaning being given is: hive_1 library is locked, the back of the tips are unknown host name: master; according to error prompt: instructions to create hive_1 library when the default save path

hdfs: // master: 9000 / user / hive / warehouse / hive_1.db / hive_01, but in fact now can not find this path, namely: Unknown host name: master, think of it like this before setting the host name namenode for the master, then the host name is changed NameNode, 
since the hive has been set metadata stored in mysql, it is necessary to modify the default path mysql recorded, two tables where major changes, are as follows:
mysql> select * from DBS;
+-------+-----------------------+--------------------------------------------------+---------+------------+------------+-----------+
| DB_ID | DESC                  | DB_LOCATION_URI                                  | NAME    | OWNER_NAME | OWNER_TYPE | CTLG_NAME |
+-------+-----------------------+--------------------------------------------------+---------+------------+------------+-----------+
|     1 | Default Hive database | hdfs://master:9000/user/hive/warehouse           | default | public     | ROLE       | hive      |
|     2 | NULL                  | hdfs://master:9000/user/hive/warehouse/hive_1.db | hive_1  | root       | USER       | hive      |
+-------+-----------------------+--------------------------------------------------+---------+------------+------------+-----------+
mysql> select * from SDS;
+-------+-------+------------------------------------------+---------------+---------------------------+----------------------------------------------------------+-------------+------------------------------------------------------------+----------+
| SD_ID | CD_ID | INPUT_FORMAT                             | IS_COMPRESSED | IS_STOREDASSUBDIRECTORIES | LOCATION                                                 | NUM_BUCKETS | OUTPUT_FORMAT                                              | SERDE_ID |
+-------+-------+------------------------------------------+---------------+---------------------------+----------------------------------------------------------+-------------+------------------------------------------------------------+----------+
|     1 |     1 | org.apache.hadoop.mapred.TextInputFormat |               |                           | hdfs://master:9000/user/hive/warehouse/hive_1.db/hive_01 |          -1 | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat |        1 |
+-------+-------+------------------------------------------+---------------+---------------------------+----------------------------------------------------------+-------------+------------------------------------------------------------+----------+
1 row in set (0.00 sec)

 

DBS modification value table DB_LOCATION_URI

mysql> update DBS set DB_LOCATION_URI=REPLACE('DB_LOCATION_URI','hdfs://master:9000/user/hive/warehouse','hdfs://namenode:9000/user/hive/warehouse')      
    -> ;
Query OK, 2 rows affected (0.05 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select * from DBS;   
+-------+-----------------------+-----------------+---------+------------+------------+-----------+ | DB_ID | DESC | DB_LOCATION_URI | NAME | OWNER_NAME | OWNER_TYPE | CTLG_NAME | +-------+-----------------------+-----------------+---------+------------+------------+-----------+ | 1 | Default Hive database | DB_LOCATION_URI | default | public | ROLE | hive | | 2 | NULL | DB_LOCATION_URI | hive_1 | root | USER | hive | +-------+-----------------------+-----------------+---------+------------+------------+-----------+ 2 rows in set (0.00 sec)

Modify the value of the LOCATION field SDS table

mysql> update SDS set LOCATION=REPLACE(LOCATION,'hdfs://master:9000/user/hive/warehouse/hive_1.db/hive_01','hdfs://namenode:9000/user/hive/warehouse/hive_1.db/hive_01');     
Query OK, 1 row affected (0.08 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from SDS;    

+-------+-------+------------------------------------------+---------------+---------------------------+------------------------------------------------------------+-------------+------------------------------------------------------------+----------+ | SD_ID | CD_ID | INPUT_FORMAT | IS_COMPRESSED | IS_STOREDASSUBDIRECTORIES | LOCATION | NUM_BUCKETS | OUTPUT_FORMAT | SERDE_ID | +-------+-------+------------------------------------------+---------------+---------------------------+------------------------------------------------------------+-------------+------------------------------------------------------------+----------+ | 1 | 1 | org.apache.hadoop.mapred.TextInputFormat | | | hdfs://namenode:9000/user/hive/warehouse/hive_1.db/hive_01 | -1 | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat | 1 | +-------+-------+------------------------------------------+---------------+---------------------------+------------------------------------------------------------+-------------+------------------------------------------------------------+----------+ 1 row in set (0.01 sec)

Modification is completed, restart mysql service, execute the query operation in the hive:

hive> select * from hive_01;
OK
Time taken: 2.329 seconds
hive> 

OK ...... everything is normal.

This example can be applied to modify the default port HDFS, host name, and so on.

Guess you like

Origin www.cnblogs.com/kylinku/p/12129540.html
Recommended