九十、NameNode端口修改后,Hive中查询表数据报错

25 篇文章 3 订阅

自从我将namenode的端口从9000 改为 8020后,再次连接hive,查询表中数据时报错

hive> select * from student;
FAILED: SemanticException Unable to determine if hdfs://kylin141:9000/user/hive/warehouse/test.db/student is encrypted: org.apache.hadoop.hive.ql.metadata.HiveException: java.net.ConnectException: Call From kylin141/192.168.59.141 to kylin141:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused

查看了几篇CSDN博客,终于找到了解决方法

进入MySQL,找到元数据库中DBS、SDS两张表,然后修改一下两张表中一个字段值

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| metastore          |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql> use metastore;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;

找到两张表,修改字段值

mysql> update DBS set DB_LOCATION_URI=REPLACE(DB_LOCATION_URI,'kylin141:9000','kylin141:8020');
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> update SDS set LOCATION=REPLACE(LOCATION,'kylin141:9000','kylin141:8020');
Query OK, 2 rows affected (0.00 sec)
Rows matched: 3  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 | hdfs://kylin141:8020/user/hive/warehouse         | default | public     | ROLE       | hive      |
|     6 | NULL                  | hdfs://kylin141:8020/user/hive/warehouse/test.db | test    | root       | USER       | hive      |
+-------+-----------------------+--------------------------------------------------+---------+------------+------------+-----------+
2 rows in set (0.00 sec)
 

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://kylin141:8020/user/hive/warehouse/test            |          -1 | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat |        1 |
|     6 |     6 | org.apache.hadoop.mapred.TextInputFormat |               |                           | hdfs://kylin141:8020/user/hive/warehouse/test.db/student |          -1 | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat |        6 |
|    11 |    11 | org.apache.hadoop.mapred.TextInputFormat |               |                           | hdfs://kylin141:8020/user/hive/warehouse/test1           |          -1 | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat |       11 |
+-------+-------+------------------------------------------+---------------+---------------------------+----------------------------------------------------------+-------------+------------------------------------------------------------+----------+
3 rows in set (0.00 sec)

确认端口修改成功,重新登录hive即可!

注意点:1.元数据库有的人是hive,有的人是metastore,这个要根据自己创建的元数据名字

              2.修改语句中,要把kylin141  改成自己的机器名字

乐于奉献共享,帮助你我他!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天地风雷水火山泽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值