linux中一键启动和关闭hadoop\yarn\hive的Shell脚本
时间: 2023-05-29 12:04:39 浏览: 200
启动hadoop:
```
#!/bin/bash
# Start Hadoop daemons
$HADOOP_HOME/sbin/start-dfs.sh
$HADOOP_HOME/sbin/start-yarn.sh
# Start Hadoop services
$HADOOP_HOME/bin/hdfs dfsadmin -safemode leave
$HADOOP_HOME/bin/hdfs dfs -mkdir /tmp
$HADOOP_HOME/bin/hdfs dfs -mkdir /user
$HADOOP_HOME/bin/hdfs dfs -mkdir /user/hadoop
$HADOOP_HOME/bin/hdfs dfs -chmod 777 /tmp
$HADOOP_HOME/bin/hdfs dfs -chmod 777 /user/hadoop
$HADOOP_HOME/bin/hdfs dfs -chmod 777 /user/hadoop/*
$HADOOP_HOME/bin/yarn app -list
```
关闭hadoop:
```
#!/bin/bash
# Stop Hadoop daemons
$HADOOP_HOME/sbin/stop-dfs.sh
$HADOOP_HOME/sbin/stop-yarn.sh
```
启动hive:
```
#!/bin/bash
# Start Hive service
$HIVE_HOME/bin/hive --service metastore &
$HIVE_HOME/bin/hive --service hiveserver2 &
```
关闭hive:
```
#!/bin/bash
# Stop Hive service
$HIVE_HOME/bin/hive --service metastore -stop
$HIVE_HOME/bin/hive --service hiveserver2 -stop
```
阅读全文