Loading... # hive启动步骤 ## 1、启动集群 确定hadoop集群都启动成功了 在浏览器访问 `hadoop21:9870` 能访问就是好的 ```css my_hadoop start # 启动hadoop集群 jpsall # 查看所有集群的进程 ``` <div class="panel panel-default collapse-panel box-shadow-wrap-lg"><div class="panel-heading panel-collapse" data-toggle="collapse" data-target="#collapse-27f1f6a33bfbe5fdf0fe58f669966bc837" aria-expanded="true"><div class="accordion-toggle"><span style="">查看详细:</span> <i class="pull-right fontello icon-fw fontello-angle-right"></i> </div> </div> <div class="panel-body collapse-panel-body"> <div id="collapse-27f1f6a33bfbe5fdf0fe58f669966bc837" class="collapse collapse-content"><p></p> ```css [root@hadoop21 conf]# my_hadoop start =================== 启动 hadoop集群 =================== --------------- 启动 hdfs --------------- Starting namenodes on [hadoop21] 上一次登录:六 5月 4 06:11:28 CST 2024 Starting datanodes 上一次登录:六 5月 4 06:19:04 CST 2024 Starting secondary namenodes [hadoop23] 上一次登录:六 5月 4 06:19:07 CST 2024 --------------- 启动 yarn --------------- Starting resourcemanager 上一次登录:六 5月 4 06:11:17 CST 2024 Starting nodemanagers 上一次登录:六 5月 4 06:19:23 CST 2024 [2]+ 退出 143 nohup hive --service hiveserver2 2> /tmp/hive_server2_error.log(工作目录:~) (当前工作目录:/opt/module/hive/conf) [root@hadoop21 conf]# jpsall =============== hadoop21 =============== 4707 NameNode 5171 NodeManager 4842 DataNode 5293 Jps =============== hadoop22 =============== 3493 Jps 2809 DataNode 3002 ResourceManager 3134 NodeManager =============== hadoop23 =============== 2641 Jps 2519 NodeManager 2329 DataNode 2429 SecondaryNameNode [root@hadoop21 conf]# ``` <p></p></div></div></div> ## 2、启动hive服务 必须启动以下两个服务才可以使用beeline ![][1] 启动 hiveserver2 ```css nohup hive --service hiveserver2 2>/tmp/hive_server2_error.log & ``` 启动 metastore ```css nohup hive --service metastore 2>/tmp/hive_metastore_error.log & ``` ## 3、使用IDEA(Java编辑器)连接JDBC 参考资料:在idea连接hive:https://blog.csdn.net/windinroad/article/details/123922043 ## 3、在linux中使用beeline连接jdbc ```css beeline -u jdbc:hive2://hadoop21:10000 -n root ``` # hive关闭步骤 ## 1、关闭HiveServer2 ```css jps -m # 出现最前面的就是进程号 kill [进程号] ``` 如: ```css 2651 RunJar /opt/module/hive/lib/hive-service-3.1.2.jar org.apache.hive.service.server.HiveServer2 4511 Jps -m [root@hadoop21 conf]# kill 2651 [1]- 退出 143 nohup hive --service metastore 2> /tmp/hive_metastore_error.log(工作目录:~) (当前工作目录:/opt/module/hive/conf) ``` ## 2、关闭hadoop 如果之前配置过hadoop集群脚本命令可以用`my_hadoop `来关闭 ```css my_hadoop stop ``` 如果没有配置集群脚本: ```css # 在hadoop22 关闭yarn stop-yarn.sh # 在hadoop21 关闭HDFS stop-dfs.sh ``` [1]: https://a-hxin.cn/usr/uploads/2024/05/2041646776.png 最后修改:2024 年 05 月 20 日 © 允许规范转载 打赏 赞赏作者 赞 2 咱们谁跟谁,用不着~