当前位置:   article > 正文

hive启动命令_hivemetastore启动

hivemetastore启动

bin/hive客户端

1、启动元数据管理服务(必须启动,否则无法工作)

        前台启动:bin/hive --service metastore

        后台启动:nohup bin/hive --service metastore >> logs/metastore.log 2>&1 &

2、启动客户端

        Hive Shell方式(可以直接写SQL): bin/hive

  1. Last login: Sat May 27 08:10:46 2023
  2. [root@node1 ~]# /export/server/hive/bin/hive
  3. SLF4J: Class path contains multiple SLF4J bindings.
  4. SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.3-bin/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  5. SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  6. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  7. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
  8. SLF4J: Class path contains multiple SLF4J bindings.
  9. SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.3-bin/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  10. SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  11. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  12. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
  13. Hive Session ID = 54980ee6-d20b-4382-b19f-473d7371bc48
  14. Logging initialized using configuration in jar:file:/export/server/apache-hive-3.1.3-bin/lib/hive-common-3.1.3.jar!/hive-log4j2.properties Async: true
  15. Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
  16. Hive Session ID = 69151652-3030-496e-bf5f-d23e37b42a34
  17. hive> show databases;
  18. OK
  19. default
  20. Time taken: 0.558 seconds, Fetched: 1 row(s)

Beeline工具连接hiveserver2客户端

先启动metastore服务端,在启动hiveserver2客户端,最后启动Beeline工具连接客户端

1、启动metastore

2、启动hiveserver2

前台启动:bin/hive --service   hiveserver2

后台启动:nohup bin/hive --service hiveserver2 >> logs/hiveserver2.log 2>&1 &

3、启动Beeline

启动hive安装目录下的bin/beeline

  1. [root@node1 ~]# /export/server/hive/bin/beeline
  2. SLF4J: Class path contains multiple SLF4J bindings.
  3. SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.3-bin/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  4. SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  5. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  6. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
  7. SLF4J: Class path contains multiple SLF4J bindings.
  8. SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.3-bin/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  9. SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  10. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  11. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
  12. Beeline version 3.1.3 by Apache Hive
  13. beeline> !connect jdbc:hive2://node1:10000
  14. Connecting to jdbc:hive2://node1:10000
  15. Enter username for jdbc:hive2://node1:10000: root
  16. Enter password for jdbc:hive2://node1:10000:
  17. Connected to: Apache Hive (version 3.1.3)
  18. Driver: Hive JDBC (version 3.1.3)
  19. Transaction isolation: TRANSACTION_REPEATABLE_READ
  20. 0: jdbc:hive2://node1:10000> show databases;
  21. INFO : Compiling command(queryId=root_20230527082711_5729d7f2-3dfa-4bfc-a0e8-3202a3d321da): show databases
  22. INFO : Concurrency mode is disabled, not creating a lock manager
  23. INFO : Semantic Analysis Completed (retrial = false)
  24. INFO : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
  25. INFO : Completed compiling command(queryId=root_20230527082711_5729d7f2-3dfa-4bfc-a0e8-3202a3d321da); Time taken: 0.77 seconds
  26. INFO : Concurrency mode is disabled, not creating a lock manager
  27. INFO : Executing command(queryId=root_20230527082711_5729d7f2-3dfa-4bfc-a0e8-3202a3d321da): show databases
  28. INFO : Starting task [Stage-0:DDL] in serial mode
  29. INFO : Completed executing command(queryId=root_20230527082711_5729d7f2-3dfa-4bfc-a0e8-3202a3d321da); Time taken: 0.02 seconds
  30. INFO : OK
  31. INFO : Concurrency mode is disabled, not creating a lock manager
  32. +----------------+
  33. | database_name |
  34. +----------------+
  35. | default |
  36. +----------------+
  37. 1 row selected (1.267 seconds)
  38. 0: jdbc:hive2://node1:10000> use default;
  39. INFO : Compiling command(queryId=root_20230527082722_f32f03bb-0e82-435d-8765-199834588275): use default
  40. INFO : Concurrency mode is disabled, not creating a lock manager
  41. INFO : Semantic Analysis Completed (retrial = false)
  42. INFO : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
  43. INFO : Completed compiling command(queryId=root_20230527082722_f32f03bb-0e82-435d-8765-199834588275); Time taken: 0.031 seconds
  44. INFO : Concurrency mode is disabled, not creating a lock manager
  45. INFO : Executing command(queryId=root_20230527082722_f32f03bb-0e82-435d-8765-199834588275): use default
  46. INFO : Starting task [Stage-0:DDL] in serial mode
  47. INFO : Completed executing command(queryId=root_20230527082722_f32f03bb-0e82-435d-8765-199834588275); Time taken: 0.012 seconds
  48. INFO : OK
  49. INFO : Concurrency mode is disabled, not creating a lock manager
  50. No rows affected (0.062 seconds)
  51. 0: jdbc:hive2://node1:10000>

正常启动后会出现表格形式展示hive中的数据库。而使用bin/hive方式启动客户端,不会以表格形式展示,使用Beeline方式比较可视化一些。

!connect jdbc:hive2://node1:10000 

beeline工具使用hive2协议连接hiveserver2客户端

node1为主机名称,由于我设置了主机映射,可以直接使用主机名,代替ip地址

10000为连接hiveserver2的10000端口

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/429589
推荐阅读
相关标签
  

闽ICP备14008679号