hive的启动和停止

一、启动后台运行

打出日志便于差错,如不需要可省略。
[hadoop ~]# nohup hive --service metastore >> ~/metastore.log 2>&1 &        ##hivemetastore
[hadoop ~]# nohup  hive --service hiveserver2 >> ~/hiveserver2.log 2>&1 &   ##hiveserver2,jdbc连接需要
建议指定日志路径,方便查找问题。否则都会存到nohup.out文件中。
~/hiveserver2.log

 

二、停止后台进程

1、先查看端口信息

[hadoop ~]# vi ../hive/conf/hive-site.xml
 
    hive.metastore.port
    9083
    Hive metastore listener port
 

 
    hive.server2.thrift.port
    10000
    Port number of HiveServer2 Thrift interface when hive.server2.transport.mode is 'binary'.
 

2、查看进程

1) 方法一、使用netstat查找端口号的进程

[hadoop ~]# netstat  -lnp|grep 9083
tcp    LISTEN     0      50        *:9083                  *:*                   users:(("java",pid=33253,fd=546))
[hadoop ~]# netstat  -lnp|grep 10000
tcp    LISTEN     0      50        *:10000                 *:*                   users:(("java",pid=33322,fd=572))

2) 方法二、centos 中,使用ss命令代替netstat查找端口号的进程

[hadoop ~]# ss -lnp|grep 9083
tcp    LISTEN     0      50        *:9083                  *:*                   users:(("java",pid=33253,fd=546))
[hadoop ~]# ss -lnp|grep 10000
tcp    LISTEN     0      50        *:10000                 *:*                   users:(("java",pid=33322fd=572))

3) 方法三、查看hive进程

[hadoop ~]# ps -aux|grep hive

hadoop 33253 0.4 14.9 2330148 357316 pts/2 Sl 04:38 1:22 /usr/local/jdk1.8.0_161/bin/java -Xmx512m -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/usr/local/hadoop/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/usr/local/hadoop -Dhadoop.id.str=hadoop -Dhadoop.root.logger=INFO,console -Djava.library.path=/usr/local/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Xmx512m -Dlog4j.configurationFile=hive-log4j2.properties -Djava.util.logging.config.file=/usr/local/hive2/conf/parquet-logging.properties -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.util.RunJar /usr/local/hive2/lib/hive-metastore-2.2.0.jar org.apache.hadoop.hive.metastore.HiveMetaStore

hadoop 33322 1.1 17.1 2331028 407888 pts/2 Sl 04:38 3:23 /usr/local/jdk1.8.0_161/bin/java -Xmx512m -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/usr/local/hadoop/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/usr/local/hadoop -Dhadoop.id.str=hadoop -Dhadoop.root.logger=INFO,console -Djava.library.path=/usr/local/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Xmx512m -Dlog4j.configurationFile=hive-log4j2.properties -Djava.util.logging.config.file=/usr/local/hive2/conf/parquet-logging.properties -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.util.RunJar /usr/local/hive2/lib/hive-service-2.2.0.jar org.apache.hive.service.server.HiveServer2

3、根据方法1、2、3的pid,杀死进程

[hadoop ~]# kill -9 33253
[hadoop ~]# kill -9 33322

你可能感兴趣的:(hive)