Created
April 18, 2018 09:03
-
-
Save lilongen/247fc3f138c6da130367cd4a1ffe4ceb to your computer and use it in GitHub Desktop.
clean.uninstall.cdh.on.centos7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# url: https://www.cloudera.com/documentation/enterprise/5-14-x/topics/cm_ig_uninstall_cm.html#concept_x4y_pgz_jm | |
# | |
# 1. Record User Data Paths | |
# 2. Stop all Services | |
# 3. Deactivate and Remove Parcels | |
# 4. Delete the Cluster | |
# 5. Uninstall the Cloudera Manager Server | |
# 6. Uninstall Cloudera Manager Agent and Managed Software | |
# 7. Remove Cloudera Manager and User Data | |
# a. Kill Cloudera Manager and Managed Processes | |
# b. Remove Cloudera Manager Data | |
# c. Remove the Cloudera Manager Lock File | |
# d. Remove User Data | |
# e. Stop and Remove External Databases | |
# do 1-4 on cm web | |
# followings are 5~7 | |
# on cloudera manager server host | |
service cloudera-scm-server stop | |
yum remove cloudera-manager-server -y | |
# on all cloudera manager agent hosts | |
service cloudera-scm-agent next_stop_hard | |
service cloudera-scm-agent stop | |
yum remove 'cloudera-manager-*' -y | |
yum clean all | |
# Kill Cloudera Manager and Managed Processes | |
# On all Agent hosts, kill any running Cloudera Manager and managed processes: | |
for u in cloudera-scm flume hadoop hdfs hbase hive httpfs hue impala llama mapred oozie solr spark sqoop sqoop2 yarn zookeeper; do | |
kill $(ps -u $u -o pid=) | |
done | |
# Remove Cloudera Manager Data | |
umount cm_processes | |
rm -Rf /usr/share/cmf /var/lib/cloudera* /var/cache/yum/cloudera* /var/log/cloudera* /var/run/cloudera* | |
# Remove the Cloudera Manager Lock File | |
# On all Agent hosts, run this command to remove the Cloudera Manager lock file: | |
rm /tmp/.scm_prepare_node.lock | |
# Remove User Data | |
# This step permanently removes all user data. To preserve the data, copy it to another cluster using the distcp command before starting the uninstall process. On all Agent hosts, run the following commands: | |
rm -Rf /var/lib/flume-ng /var/lib/hadoop* /var/lib/hue /var/lib/navigator /var/lib/oozie /var/lib/solr /var/lib/sqoop* /var/lib/zookeeper | |
# Run the following command on each data drive on all Agent hosts (adjust the paths for the data drives on each host): | |
rm -Rf data_drive_path/dfs data_drive_path/mapred data_drive_path/yarn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment