Stopping CDH Services Using the Command Line

To shut down all Hadoop Common system services (HDFS, YARN, MRv1), run the following on each host in the cluster:

$ for x in `cd /etc/init.d ; ls hadoop-*` ; do sudo service $x stop ; done

To verify that no Hadoop processes are running, run the following command on each host in the cluster:

# ps -aef | grep java
To stop system services individually, use the instructions in the table below.
Order Service Comments Instructions
1 Hue  
sudo service hue stop
2 Impala  
sudo service impala-server stop
sudo service impala-catalog stop
sudo service impala-state-store stop
3 Oozie  
sudo service oozie stop
4 Hive Exit the Hive console and ensure no Hive scripts are running. Stop the Hive server, HCatalog, and metastore daemon on each client.
sudo service hiveserver2 stop
sudo service hive-webhcat-server stop
sudo service hive-metastore stop
5 Flume 1.x There is no Flume master.
sudo service flume-ng-agent stop
6 Sqoop 1  
sudo service sqoop-metastore stop
6 Sqoop 2  
sudo service sqoop2-server stop
7 Lily HBase Indexer (Solr/HBase Indexer)  
sudo service hbase-solr-indexer stop
10 Spark  
sudo service spark-worker stop
sudo service spark-history-server stop
sudo service spark-master stop
8 Sentry Only present on a secure configuration.
sudo service sentry-store stop
9 Solr Search  
sudo service solr-server stop
10 HBase Stop the Thrift server and clients, followed by RegionServers and finally the Master.
sudo service hbase-thrift stop
sudo service hbase-rest stop
sudo service hbase-regionserver stop
sudo service hbase-master stop
11 MapReduce v1 Stop the JobTracker service, then stop the TaskTracker service on all nodes where it is running. For MRv1 HA setup:
sudo service hadoop-0.20-mapreduce-jobtrackerha stop 
For Non-HA setup:
sudo service hadoop-0.20-mapreduce-jobtracker stop 
For all types of MRv1 setups:
sudo service hadoop-0.20-mapreduce-tasktracker stop
12 YARN Stop the JobHistory server, followed by the ResourceManager and each of the NodeManagers.
$ sudo service hadoop-mapreduce-historyserver stop
$ sudo service hadoop-yarn-resourcemanager stop
$ sudo service hadoop-yarn-nodemanager stop
13 HDFS

Stop HttpFS and the NFS Gateway (if present).

Stop the Secondary NameNode, then the primary NameNode, followed by Journal nodes (if present) and then each of DataNodes.

sudo service hadoop-httpfs stop
sudo service hadoop-hdfs-nfs3 stop
sudo service hadoop-hdfs-secondarynamenode stop
sudo service hadoop-hdfs-namenode stop
sudo service hadoop-hdfs-journalnode stop
sudo service hadoop-hdfs-datanode stop 
14 KMS (Key Management Server) Only present if HDFS at rest encryption is enabled
sudo service hadoop-kms-server stop
15 ZooKeeper  
sudo service zookeeper-server stop