停止Hive

查看hive进程

jps -l -m 命令解读:

-m:输出main method的参数
-l:输出完全的包名,应用主类名,jar的完全路径名

  1. [root@zjj101 conf]# jps -l -m
  2. 21955 org.apache.flume.node.Application -n a1 -f /root/soft/apache-flume-1.7.0/conf/f1.conf
  3. 11272 org.apache.hadoop.hdfs.server.datanode.DataNode
  4. 14824 org.apache.hadoop.util.RunJar /root/soft/hive-1.2.1/lib/hive-service-1.2.1.jar org.apache.hive.service.server.HiveServer2 --hiveconf hive.aux.jars.path=file:///root/soft/hadoop-2.7.2/share/hadoop/common/hadoop-lzo-0.4.21-SNAPSHOT.jar,file:///root/soft/tez-0.9.1/hadoop-shim-0.9.1.jar,file:///root/soft/tez-0.9.1/hadoop-shim-2.7-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-api-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-common-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-dag-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-examples-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-ext-service-tests-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-history-parser-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-javadoc-tools-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-job-analyzer-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-mapreduce-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-runtime-internals-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-runtime-library-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-tests-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-yarn-timeline-hi
  5. 87785 kafka.Kafka /root/soft/kafka_2.11-0.11.0.2/config/server.properties
  6. 98232 gmall-logger-0.0.1-SNAPSHOT.jar
  7. 54409 sun.tools.jps.Jps -l -m
  8. 11134 org.apache.hadoop.hdfs.server.namenode.NameNode

仔细观察 RunJar的

看到 进程号为14824 的,, org.apache.hadoop.util.RunJar /root/soft/hive-1.2.1/lib/hive-service-1.2.1.jar org.apache.hive.service.server.HiveServer2 —hiveconf 说明是hive后台进程

  1. 14824 org.apache.hadoop.util.RunJar /root/soft/hive-1.2.1/lib/hive-service-1.2.1.jar org.apache.hive.service.server.HiveServer2 --hiveconf hive.aux.jars.path=file:///root/soft/hadoop-2.7.2/share/hadoop/common/hadoop-lzo-0.4.21-SNAPSHOT.jar,file:///root/soft/tez-0.9.1/hadoop-shim-0.9.1.jar,file:///root/soft/tez-0.9.1/hadoop-shim-2.7-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-api-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-common-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-dag-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-examples-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-ext-service-tests-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-history-parser-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-javadoc-tools-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-job-analyzer-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-mapreduce-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-runtime-internals-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-runtime-library-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-tests-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-yarn-timeline-hi

强杀Hive

  1. [root@zjj101 conf]# kill -9 14824

后台启动Hive

可以在任意目录下执行命令 ,前提是配置了hive的环境变量

  1. [root@zjj101 conf]# nohup hive --service hiveserver2 &
  2. [3] 54788
  3. [root@zjj101 conf]# nohup: 忽略输入并把输出追加到"nohup.out"

也可以给启动输出信息指定到日志里面 ,在当前目录下生成一个hiveserver2.log文件,方便使用tail -f 查看启动信息

  1. nohup hive --service hiveserver2 >hiveserver2.log 2>&1 &

上面说是54788 进程号

jps -m 看一下54788 , 说明启动完了.

  1. [root@zjj101 conf]# jps -m
  2. 21955 Application -n a1 -f /root/soft/apache-flume-1.7.0/conf/f1.conf
  3. 54788 RunJar /root/soft/hive-1.2.1/lib/hive-service-1.2.1.jar org.apache.hive.service.server.HiveServer2 --hiveconf hive.aux.jars.path=file:///root/soft/hadoop-2.7.2/share/hadoop/common/hadoop-lzo-0.4.21-SNAPSHOT.jar,file:///root/soft/tez-0.9.1/hadoop-shim-0.9.1.jar,file:///root/soft/tez-0.9.1/hadoop-shim-2.7-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-api-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-common-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-dag-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-examples-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-ext-service-tests-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-history-parser-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-javadoc-tools-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-job-analyzer-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-mapreduce-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-runtime-internals-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-runtime-library-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-tests-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-yarn-timeline-hi
  4. 54630 RunJar /root/soft/hive-1.2.1/lib/hive-cli-1.2.1.jar org.apache.hadoop.hive.cli.CliDriver --hiveconf hive.aux.jars.path=file:///root/soft/hadoop-2.7.2/share/hadoop/common/hadoop-lzo-0.4.21-SNAPSHOT.jar,file:///root/soft/tez-0.9.1/hadoop-shim-0.9.1.jar,file:///root/soft/tez-0.9.1/hadoop-shim-2.7-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-api-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-common-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-dag-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-examples-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-ext-service-tests-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-history-parser-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-javadoc-tools-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-job-analyzer-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-mapreduce-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-runtime-internals-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-runtime-library-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-tests-0.9.1.jar,file:///root/soft/tez-0.9.1/tez-yarn-timeline-history-0.9.
  5. 11272 DataNode
  6. 87785 Kafka /root/soft/kafka_2.11-0.11.0.2/config/server.properties
  7. 98232 jar
  8. 11134 NameNode
  9. 55054 Jps -m
  10. [root@zjj101 conf]#

验证一下hive

我用DataGrip 连接的, 发现能连上Hive, 说明重启好了

https://blog.csdn.net/qq_41489540/article/details/108717556

你们也可以用别的方式测试一下能不能连上Hive