ambari2.7.4卸载

卸载ambari2.7.4

1.停止服务

ambari-server stop  
ambari-agent stop  

2.卸载yum插件

通过这个命令搞出来命令 复制到脚本里去执行

yum list |egrep 'hadoop|@HDP|HDP|zookeeper|bigtop|atlas-metadata|ambari|postgresql|spark|hdp-select|ranger' |awk '{print "ssh $host \"yum remove -y  " $1 "\""}' > c.txt

3.删除用户

cat /etc/passwd |awk -F ":" '{print" ssh $host \"userdel -rf " $1 "\""}'

 

4.删除组

cat /etc/group |awk -F ":" '{print" ssh $host \"groupdel -rf " $1 "\""}'

5.删除ambari遗留数据

脚本删除

6.删除其他hadoop组件遗留数据

脚本删除

7.清理yum源数据

(脚本删除之后 创建新的yum源之后)

yum clean all  

8.清理元数据信息

mysql数据库里面原来的ambari自己的元数据表 还有 hive等其他大数据组件的元数据表 都需要手动删除 

 

ambari遗留数据删除的脚本:

!/bin/bash
#PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
#export PATH

#取得集群的所有主机名,这里需要注意:/etc/hosts配置的IP和主机名只能用一个空格分割
hostList=$(cat /etc/hosts | tail -3 | cut -d ' ' -f 2)
yumReposDir=/etc/yum.repos.d/
pingCount=5
logPre=ssh

read -p "Please input your master hostname: " master
master=${master:-"master"}
ssh $master "ambari-server stop"
#重置ambari数据库
ssh $master "ambari-server reset"

for host in $hostList
do
    #echo $host
    #检测主机的连通性
    unPing=$(ping $host -c $pingCount | grep 'Unreachable' | wc -l)
    if [ "$unPing" == "$pingCount" ]; then
        echo -e "$logPre======>$host is Unreachable,please check '/etc/hosts' file"
        continue
    fi

    echo "$logPre======>$host deleting... \n"
    #1.)删除hdp.repo、HDP.repo、HDP-UTILS.repo和ambari.repo
    ssh $host "cd $yumReposDir"
    #ssh $host "rm -rf $yumReposDir/hdp.repo"
    #ssh $host "rm -rf $yumReposDir/HDP*"
    #ssh $host "rm -rf $yumReposDir/ambari.repo"
    #103没有上面这些 
    ssh $host "rm -rf $yumReposDir/ambari*"
    
    
    #删除HDP相关的安装包 #删除ambari相关包
    ssh $host "yum remove -y  accumulo_3_1_4_0_315.x86_64"
ssh $host "yum remove -y  ambari-agent.x86_64"
ssh $host "yum remove -y  ambari-infra-solr.noarch"
ssh $host "yum remove -y  ambari-infra-solr-client.noarch"
ssh $host "yum remove -y  ambari-logsearch-logfeeder.noarch"
ssh $host "yum remove -y  ambari-logsearch-portal.noarch"
ssh $host "yum remove -y  ambari-metrics-grafana.x86_64"
ssh $host "yum remove -y  ambari-metrics-hadoop-sink.x86_64"
ssh $host "yum remove -y  ambari-metrics-monitor.x86_64"
ssh $host "yum remove -y  ambari-server.x86_64"
ssh $host "yum remove -y  atlas-metadata_3_1_4_0_315.noarch"
ssh $host "yum remove -y  atlas-metadata_3_1_4_0_315-hbase-plugin.noarch"
ssh $host "yum remove -y  1.1.0.3.1.4.0-315"
ssh $host "yum remove -y  atlas-metadata_3_1_4_0_315-hive-plugin.noarch"
ssh $host "yum remove -y  1.1.0.3.1.4.0-315"
ssh $host "yum remove -y  atlas-metadata_3_1_4_0_315-sqoop-plugin.noarch"
ssh $host "yum remove -y  1.1.0.3.1.4.0-315"
ssh $host "yum remove -y  atlas-metadata_3_1_4_0_315-storm-plugin.noarch"
ssh $host "yum remove -y  1.1.0.3.1.4.0-315"
ssh $host "yum remove -y  bigtop-jsvc.x86_64"
ssh $host "yum remove -y  bigtop-tomcat.noarch"
ssh $host "yum remove -y  datafu_3_1_4_0_315.noarch"
ssh $host "yum remove -y  druid_3_1_4_0_315.noarch"
ssh $host "yum remove -y  hadoop_3_1_4_0_315.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-client.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-hdfs.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-libhdfs.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-mapreduce.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-yarn.x86_64"
ssh $host "yum remove -y  hbase_3_1_4_0_315.noarch"
ssh $host "yum remove -y  hdp-select.noarch"
ssh $host "yum remove -y  hive_3_1_4_0_315.noarch"
ssh $host "yum remove -y  hive_3_1_4_0_315-hcatalog.noarch"
ssh $host "yum remove -y  hive_3_1_4_0_315-jdbc.noarch"
ssh $host "yum remove -y  1.0.0.3.1.4.0-315"
ssh $host "yum remove -y  kafka_3_1_4_0_315.noarch"
ssh $host "yum remove -y  knox_3_1_4_0_315.noarch"
ssh $host "yum remove -y  livy2_3_1_4_0_315.noarch"
ssh $host "yum remove -y  oozie_3_1_4_0_315.noarch"
ssh $host "yum remove -y  oozie_3_1_4_0_315-client.noarch"
ssh $host "yum remove -y  oozie_3_1_4_0_315-common.noarch"
ssh $host "yum remove -y  oozie_3_1_4_0_315-sharelib.noarch"
ssh $host "yum remove -y  oozie_3_1_4_0_315-sharelib-distcp.noarch"
ssh $host "yum remove -y  4.3.1.3.1.4.0-315"
ssh $host "yum remove -y  oozie_3_1_4_0_315-sharelib-hive.noarch"
ssh $host "yum remove -y  oozie_3_1_4_0_315-sharelib-hive2.noarch"
ssh $host "yum remove -y  4.3.1.3.1.4.0-315"
ssh $host "yum remove -y  oozie_3_1_4_0_315-sharelib-pig.noarch"
ssh $host "yum remove -y  oozie_3_1_4_0_315-sharelib-spark.noarch"
ssh $host "yum remove -y  oozie_3_1_4_0_315-sharelib-sqoop.noarch"
ssh $host "yum remove -y  oozie_3_1_4_0_315-webapp.noarch"
ssh $host "yum remove -y  phoenix_3_1_4_0_315.noarch"
ssh $host "yum remove -y  pig_3_1_4_0_315.noarch"
ssh $host "yum remove -y  postgresql.x86_64"
ssh $host "yum remove -y  postgresql-libs.x86_64"
ssh $host "yum remove -y  postgresql-server.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-atlas-plugin.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-hbase-plugin.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-hdfs-plugin.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-hive-plugin.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-kafka-plugin.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-knox-plugin.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-storm-plugin.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-yarn-plugin.x86_64"
ssh $host "yum remove -y  smartsense-hst.x86_64"
ssh $host "yum remove -y  snappy-devel.x86_64"
ssh $host "yum remove -y  spark-atlas-connector_3_1_4_0_315.noarch"
ssh $host "yum remove -y  spark2_3_1_4_0_315.noarch"
ssh $host "yum remove -y  spark2_3_1_4_0_315-python.noarch"
ssh $host "yum remove -y  spark2_3_1_4_0_315-yarn-shuffle.noarch"
ssh $host "yum remove -y  sqoop_3_1_4_0_315.noarch"
ssh $host "yum remove -y  storm_3_1_4_0_315.x86_64"
ssh $host "yum remove -y  superset_3_1_4_0_315.x86_64"
ssh $host "yum remove -y  tez_3_1_4_0_315.noarch"
ssh $host "yum remove -y  zeppelin_3_1_4_0_315.noarch"
ssh $host "yum remove -y  zookeeper_3_1_4_0_315.noarch"
ssh $host "yum remove -y  zookeeper_3_1_4_0_315-server.noarch"
ssh $host "yum remove -y  accumulo.noarch"
ssh $host "yum remove -y  accumulo-conf-standalone.noarch"
ssh $host "yum remove -y  accumulo-source.noarch"
ssh $host "yum remove -y  accumulo-test.noarch"
ssh $host "yum remove -y  1.7.0.3.1.4.0-315"
ssh $host "yum remove -y  accumulo_3_1_4_0_315-source.x86_64"
ssh $host "yum remove -y  accumulo_3_1_4_0_315-test.x86_64"
ssh $host "yum remove -y  ambari-infra-manager.noarch"
ssh $host "yum remove -y  ambari-metrics-collector.x86_64"
ssh $host "yum remove -y  ambari-metrics-common.noarch"
ssh $host "yum remove -y  atlas-metadata.noarch"
ssh $host "yum remove -y  atlas-metadata-hbase-plugin.noarch"
ssh $host "yum remove -y  atlas-metadata-hive-plugin.noarch"
ssh $host "yum remove -y  atlas-metadata-kafka-plugin.noarch"
ssh $host "yum remove -y  atlas-metadata-sqoop-plugin.noarch"
ssh $host "yum remove -y  atlas-metadata-storm-plugin.noarch"
ssh $host "yum remove -y  atlas-metadata_3_1_4_0_315-kafka-plugin.noarch"
ssh $host "yum remove -y  1.1.0.3.1.4.0-315"
ssh $host "yum remove -y  calligra-kexi-driver-postgresql.x86_64"
ssh $host "yum remove -y  collectd-postgresql.x86_64"
ssh $host "yum remove -y  collectd-zookeeper.x86_64"
ssh $host "yum remove -y  datafu.noarch"
ssh $host "yum remove -y  druid.noarch"
ssh $host "yum remove -y  freeradius-postgresql.x86_64"
ssh $host "yum remove -y  hadoop.noarch"
ssh $host "yum remove -y  hadoop-client.noarch"
ssh $host "yum remove -y  hadoop-conf-pseudo.noarch"
ssh $host "yum remove -y  hadoop-hdfs.noarch"
ssh $host "yum remove -y  hadoop-hdfs-datanode.noarch"
ssh $host "yum remove -y  hadoop-hdfs-fuse.noarch"
ssh $host "yum remove -y  hadoop-hdfs-journalnode.noarch"
ssh $host "yum remove -y  hadoop-hdfs-namenode.noarch"
ssh $host "yum remove -y  hadoop-hdfs-secondarynamenode.noarch"
ssh $host "yum remove -y  hadoop-hdfs-zkfc.noarch"
ssh $host "yum remove -y  hadoop-httpfs.noarch"
ssh $host "yum remove -y  hadoop-httpfs-server.noarch"
ssh $host "yum remove -y  hadoop-libhdfs.noarch"
ssh $host "yum remove -y  hadoop-mapreduce.noarch"
ssh $host "yum remove -y  hadoop-mapreduce-historyserver.noarch"
ssh $host "yum remove -y  hadoop-source.noarch"
ssh $host "yum remove -y  hadoop-yarn.noarch"
ssh $host "yum remove -y  hadoop-yarn-nodemanager.noarch"
ssh $host "yum remove -y  hadoop-yarn-proxyserver.noarch"
ssh $host "yum remove -y  hadoop-yarn-registrydns.noarch"
ssh $host "yum remove -y  hadoop-yarn-resourcemanager.noarch"
ssh $host "yum remove -y  hadoop-yarn-timelinereader.noarch"
ssh $host "yum remove -y  hadoop-yarn-timelineserver.noarch"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-conf-pseudo.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-hdfs-datanode.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-hdfs-fuse.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-hdfs-journalnode.x86_64"
ssh $host "yum remove -y  3.1.1.3.1.4.0-315"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-hdfs-namenode.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-hdfs-secondarynamenode.x86_64"
ssh $host "yum remove -y  3.1.1.3.1.4.0-315"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-hdfs-zkfc.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-httpfs.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-httpfs-server.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-mapreduce-historyserver.x86_64"
ssh $host "yum remove -y  3.1.1.3.1.4.0-315"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-source.x86_64"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-yarn-nodemanager.x86_64"
ssh $host "yum remove -y  3.1.1.3.1.4.0-315"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-yarn-proxyserver.x86_64"
ssh $host "yum remove -y  3.1.1.3.1.4.0-315"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-yarn-registrydns.x86_64"
ssh $host "yum remove -y  3.1.1.3.1.4.0-315"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-yarn-resourcemanager.x86_64"
ssh $host "yum remove -y  3.1.1.3.1.4.0-315"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-yarn-timelinereader.x86_64"
ssh $host "yum remove -y  3.1.1.3.1.4.0-315"
ssh $host "yum remove -y  hadoop_3_1_4_0_315-yarn-timelineserver.x86_64"
ssh $host "yum remove -y  3.1.1.3.1.4.0-315"
ssh $host "yum remove -y  hbase.noarch"
ssh $host "yum remove -y  hbase-doc.noarch"
ssh $host "yum remove -y  hbase-master.noarch"
ssh $host "yum remove -y  hbase-regionserver.noarch"
ssh $host "yum remove -y  hbase-rest.noarch"
ssh $host "yum remove -y  hbase-thrift.noarch"
ssh $host "yum remove -y  hbase-thrift2.noarch"
ssh $host "yum remove -y  hbase_3_1_4_0_315-doc.noarch"
ssh $host "yum remove -y  hbase_3_1_4_0_315-master.noarch"
ssh $host "yum remove -y  hbase_3_1_4_0_315-regionserver.noarch"
ssh $host "yum remove -y  hbase_3_1_4_0_315-rest.noarch"
ssh $host "yum remove -y  hbase_3_1_4_0_315-thrift.noarch"
ssh $host "yum remove -y  hbase_3_1_4_0_315-thrift2.noarch"
ssh $host "yum remove -y  hive.noarch"
ssh $host "yum remove -y  hive-hcatalog.noarch"
ssh $host "yum remove -y  hive-hcatalog-server.noarch"
ssh $host "yum remove -y  hive-jdbc.noarch"
ssh $host "yum remove -y  hive-metastore.noarch"
ssh $host "yum remove -y  hive-server.noarch"
ssh $host "yum remove -y  hive-server2.noarch"
ssh $host "yum remove -y  hive-webhcat.noarch"
ssh $host "yum remove -y  hive-webhcat-server.noarch"
ssh $host "yum remove -y  hive_3_1_4_0_315-hcatalog-server.noarch"
ssh $host "yum remove -y  hive_3_1_4_0_315-metastore.noarch"
ssh $host "yum remove -y  hive_3_1_4_0_315-server.noarch"
ssh $host "yum remove -y  hive_3_1_4_0_315-server2.noarch"
ssh $host "yum remove -y  hive_3_1_4_0_315-webhcat.noarch"
ssh $host "yum remove -y  hive_3_1_4_0_315-webhcat-server.noarch"
ssh $host "yum remove -y  hive_warehouse_connector.noarch"
ssh $host "yum remove -y  kafka.noarch"
ssh $host "yum remove -y  knox.noarch"
ssh $host "yum remove -y  libreoffice-postgresql.x86_64"
ssh $host "yum remove -y  livy2.noarch"
ssh $host "yum remove -y  oozie.noarch"
ssh $host "yum remove -y  oozie-client.noarch"
ssh $host "yum remove -y  oozie-common.noarch"
ssh $host "yum remove -y  oozie-sharelib.noarch"
ssh $host "yum remove -y  oozie-sharelib-distcp.noarch"
ssh $host "yum remove -y  oozie-sharelib-hcatalog.noarch"
ssh $host "yum remove -y  oozie-sharelib-hive.noarch"
ssh $host "yum remove -y  oozie-sharelib-hive2.noarch"
ssh $host "yum remove -y  oozie-sharelib-mapreduce-streaming.noarch"
ssh $host "yum remove -y  oozie-sharelib-pig.noarch"
ssh $host "yum remove -y  oozie-sharelib-spark.noarch"
ssh $host "yum remove -y  oozie-sharelib-sqoop.noarch"
ssh $host "yum remove -y  oozie-webapp.noarch"
ssh $host "yum remove -y  opendbx-postgresql.x86_64"
ssh $host "yum remove -y  opensips-postgresql.x86_64"
ssh $host "yum remove -y  owncloud-postgresql.noarch"
ssh $host "yum remove -y  pcp-export-pcp2spark.x86_64"
ssh $host "yum remove -y  pcp-pmda-postgresql.x86_64"
ssh $host "yum remove -y  pdns-backend-postgresql.x86_64"
ssh $host "yum remove -y  perdition-postgresql.x86_64"
ssh $host "yum remove -y  phoenix.noarch"
ssh $host "yum remove -y  pig.noarch"
ssh $host "yum remove -y  postgresql.i686"
ssh $host "yum remove -y  postgresql-contrib.x86_64"
ssh $host "yum remove -y  postgresql-devel.i686"
ssh $host "yum remove -y  postgresql-devel.x86_64"
ssh $host "yum remove -y  postgresql-docs.x86_64"
ssh $host "yum remove -y  postgresql-jdbc.noarch"
ssh $host "yum remove -y  postgresql-jdbc-javadoc.noarch"
ssh $host "yum remove -y  postgresql-libs.i686"
ssh $host "yum remove -y  postgresql-odbc.x86_64"
ssh $host "yum remove -y  postgresql-pgpool-II.x86_64"
ssh $host "yum remove -y  postgresql-pgpool-II-devel.x86_64"
ssh $host "yum remove -y  postgresql-pgpool-II-extensions.x86_64"
ssh $host "yum remove -y  postgresql-plperl.x86_64"
ssh $host "yum remove -y  postgresql-plpython.x86_64"
ssh $host "yum remove -y  postgresql-plruby.x86_64"
ssh $host "yum remove -y  postgresql-plruby-doc.x86_64"
ssh $host "yum remove -y  postgresql-pltcl.x86_64"
ssh $host "yum remove -y  postgresql-static.i686"
ssh $host "yum remove -y  postgresql-static.x86_64"
ssh $host "yum remove -y  postgresql-test.x86_64"
ssh $host "yum remove -y  postgresql-upgrade.x86_64"
ssh $host "yum remove -y  postgresqltuner.noarch"
ssh $host "yum remove -y  proftpd-postgresql.x86_64"
ssh $host "yum remove -y  python-testing.postgresql.noarch"
ssh $host "yum remove -y  qt-postgresql.i686"
ssh $host "yum remove -y  qt-postgresql.x86_64"
ssh $host "yum remove -y  qt5-qtbase-postgresql.i686"
ssh $host "yum remove -y  qt5-qtbase-postgresql.x86_64"
ssh $host "yum remove -y  ranger-admin.noarch"
ssh $host "yum remove -y  ranger-atlas-plugin.noarch"
ssh $host "yum remove -y  ranger-hbase-plugin.noarch"
ssh $host "yum remove -y  ranger-hdfs-plugin.noarch"
ssh $host "yum remove -y  ranger-hive-plugin.noarch"
ssh $host "yum remove -y  ranger-kafka-plugin.noarch"
ssh $host "yum remove -y  ranger-kms.noarch"
ssh $host "yum remove -y  ranger-knox-plugin.noarch"
ssh $host "yum remove -y  ranger-solr-plugin.noarch"
ssh $host "yum remove -y  ranger-storm-plugin.noarch"
ssh $host "yum remove -y  ranger-tagsync.noarch"
ssh $host "yum remove -y  ranger-usersync.noarch"
ssh $host "yum remove -y  ranger-yarn-plugin.noarch"
ssh $host "yum remove -y  ranger_3_1_4_0_315-admin.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-kms.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-solr-plugin.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-tagsync.x86_64"
ssh $host "yum remove -y  ranger_3_1_4_0_315-usersync.x86_64"
ssh $host "yum remove -y  shc.noarch"
ssh $host "yum remove -y  shc_3_1_4_0_315.noarch"
ssh $host "yum remove -y  snappy.i686"
ssh $host "yum remove -y  snappy-devel.i686"
ssh $host "yum remove -y  soci-postgresql.x86_64"
ssh $host "yum remove -y  soci-postgresql-devel.x86_64"
ssh $host "yum remove -y  spark-atlas-connector.noarch"
ssh $host "yum remove -y  spark2.noarch"
ssh $host "yum remove -y  spark2-master.noarch"
ssh $host "yum remove -y  spark2-python.noarch"
ssh $host "yum remove -y  spark2-worker.noarch"
ssh $host "yum remove -y  spark2-yarn-shuffle.noarch"
ssh $host "yum remove -y  spark2_3_1_4_0_315-master.noarch"
ssh $host "yum remove -y  spark2_3_1_4_0_315-worker.noarch"
ssh $host "yum remove -y  spark_schema_registry.noarch"
ssh $host "yum remove -y  spark_schema_registry_3_1_4_0_315.noarch"
ssh $host "yum remove -y  sqoop.noarch"
ssh $host "yum remove -y  sqoop-metastore.noarch"
ssh $host "yum remove -y  sqoop_3_1_4_0_315-metastore.noarch"
ssh $host "yum remove -y  storm.noarch"
ssh $host "yum remove -y  superset.noarch"
ssh $host "yum remove -y  tez.noarch"
ssh $host "yum remove -y  zeppelin.noarch"
ssh $host "yum remove -y  zookeeper.noarch"
ssh $host "yum remove -y  zookeeper-server.noarch"
    
    #删除快捷方式 103没有
    #ssh $host "cd $alterNativesDir"
    #ssh $host "rm -rf hadoop-etc" 
    #ssh $host "rm -rf zookeeper-conf"
    #ssh $host "rm -rf hbase-conf" 
    #ssh $host "rm -rf hadoop-log" 
    #ssh $host "rm -rf hadoop-lib"
    #ssh $host "rm -rf hadoop-default" 
    #ssh $host "rm -rf oozie-conf"
    #ssh $host "rm -rf hcatalog-conf" 
    #ssh $host "rm -rf hive-conf"
    #ssh $host "rm -rf hadoop-man"
    #ssh $host "rm -rf sqoop-conf"
    #ssh $host "rm -rf hadoop-confone"

    #删除用户
 ssh $host "userdel -rf yarn-ats"
 ssh $host "userdel -rf hive"
 ssh $host "userdel -rf storm"
 ssh $host "userdel -rf infra-solr"
 ssh $host "userdel -rf zookeeper"
 ssh $host "userdel -rf oozie"
 ssh $host "userdel -rf atlas"
 ssh $host "userdel -rf ams"
 ssh $host "userdel -rf ranger"
 ssh $host "userdel -rf tez"
 ssh $host "userdel -rf zeppelin"
 ssh $host "userdel -rf kms"
 ssh $host "userdel -rf accumulo"
 ssh $host "userdel -rf livy"
 ssh $host "userdel -rf druid"
 ssh $host "userdel -rf spark"
 ssh $host "userdel -rf ambari-qa"
 ssh $host "userdel -rf kafka"
 ssh $host "userdel -rf hdfs"
 ssh $host "userdel -rf sqoop"
 ssh $host "userdel -rf yarn"
 ssh $host "userdel -rf mapred"
 ssh $host "userdel -rf hbase"
 ssh $host "userdel -rf knox"
 ssh $host "userdel -rf superset"
 ssh $host "userdel -rf logsearch"

    #删除组
     ssh $host "groupdel  -rf postgres"
 ssh $host "groupdel  -rf kms"
 ssh $host "groupdel  -rf livy"
 ssh $host "groupdel  -rf spark"
 ssh $host "groupdel  -rf ranger"
 ssh $host "groupdel  -rf hdfs"
 ssh $host "groupdel  -rf zeppelin"
 ssh $host "groupdel  -rf hadoop"
 ssh $host "groupdel  -rf knox"
 ssh $host "groupdel  -rf zookeeper"
 ssh $host "groupdel  -rf accumulo"
 ssh $host "groupdel  -rf hbase"
 ssh $host "groupdel  -rf yarn"
 ssh $host "groupdel  -rf mapred"
 ssh $host "groupdel  -rf hive"
 ssh $host "groupdel  -rf druid"
 ssh $host "groupdel  -rf oozie"
 ssh $host "groupdel  -rf storm"
 ssh $host "groupdel  -rf kafka"
 ssh $host "groupdel  -rf sqoop"
 ssh $host "groupdel  -rf superset"


    #删除文件夹
    ssh $host "rm -rf /hadoop"
    ssh $host "rm -rf /etc/hadoop" 
    ssh $host "rm -rf /etc/hbase"
    ssh $host "rm -rf /etc/hive-hcatalog" 
    ssh $host "rm -rf /etc/hive"
    ssh $host "rm -rf /etc/oozie"
    ssh $host "rm -rf /etc/sqoop"
    ssh $host "rm -rf /etc/zookeeper" 
    ssh $host "rm -rf /etc/pig"
    ssh $host "rm -rf /etc/kafka"
    ssh $host "rm -rf /etc/druid"
    ssh $host "rm -rf /etc/superset"
    ssh $host "rm -rf /etc/storm"
    ssh $host "rm -rf /etc/tez"
    ssh $host "rm -rf /etc/tez_llap"
    ssh $host "rm -rf /etc/zeppelin"
    ssh $host "rm -rf /etc/knox"
    ssh $host "rm -rf /etc/hive_llap"
    ssh $host "rm -rf /etc/atlas"
    ssh $host "rm -rf /etc/spark2"
    ssh $host "rm -rf /etc/ranger"
ssh $host "rm -rf /var/run/hadoop" 
    ssh $host "rm -rf /var/run/hbase"
    ssh $host "rm -rf /var/run/hive"
    ssh $host "rm -rf /var/run/hive-hcatalog" 
    ssh $host "rm -rf /var/run/druid"
    ssh $host "rm -rf /var/run/oozie"
    ssh $host "rm -rf /var/run/hadoop-mapreduce"
    ssh $host "rm -rf /var/run/hadoop-yarn"
    ssh $host "rm -rf /var/run/kafka"
    ssh $host "rm -rf /var/run/spark"
    ssh $host "rm -rf /var/run/spark2"
    ssh $host "rm -rf /var/run/sqoop"
    ssh $host "rm -rf /var/run/storm"
    ssh $host "rm -rf /var/run/superset"
    ssh $host "rm -rf /var/run/knox"
    
    ssh $host "rm -rf /var/run/zeppelin"
    ssh $host "rm -rf /var/run/zookeeper"
    ssh $host "rm -rf /var/run/postgresql"
ssh $host "rm -rf /var/log/hadoop" 
    ssh $host "rm -rf /var/log/hbase"
    ssh $host "rm -rf /var/log/hive"
    ssh $host "rm -rf /var/log/hive-hcatalog" 
    ssh $host "rm -rf /var/log/druid"
    ssh $host "rm -rf /var/log/oozie"
    ssh $host "rm -rf /var/log/knox"
    ssh $host "rm -rf /var/log/zookeeper"
    ssh $host "rm -rf /var/log/hadoop-mapreduce"
    ssh $host "rm -rf /var/log/hadoop-yarn"
    ssh $host "rm -rf /var/log/kafka"
    ssh $host "rm -rf /var/log/spark"
    ssh $host "rm -rf /var/log/spark2"
    ssh $host "rm -rf /var/log/sqoop"
    ssh $host "rm -rf /var/log/storm"
    ssh $host "rm -rf /var/log/superset"
    ssh $host "rm -rf /var/log/zeppelin"
    ssh $host "rm -rf /usr/lib/storm"
    ssh $host "rm -rf /var/lib/hadoop-hdfs" 
    ssh $host "rm -rf /var/lib/hive"
    ssh $host "rm -rf /var/lib/hive-hcatalog" 
    ssh $host "rm -rf /var/lib/oozie"
    ssh $host "rm -rf /var/lib/hadoop-mapreduce"
    ssh $host "rm -rf /var/lib/hadoop-yarn"
    ssh $host "rm -rf /var/lib/spark2"
    ssh $host "rm -rf /var/lib/sqoop"
    ssh $host "rm -rf /var/lib/storm"
    ssh $host "rm -rf /var/lib/superset"
    ssh $host "rm -rf /var/lib/pgsql"
    ssh $host "rm -rf /var/lib/knox"
ssh $host "rm -rf /var/tmp/oozie"
    ssh $host "rm -rf /var/tmp/sqoop"
    ssh $host "rm -rf /tmp/hive"
    ssh $host "rm -rf /tmp/hbase-hbase"
    ssh $host "rm -rf /tmp/spark2"
    ssh $host "rm -rf /tmp/hadoop-hdfs"
    ssh $host "rm -rf /tmp/hsperfdata_*"
    ssh $host "rm -rf /var/druid"
    #根目录的hadoop
    ssh $host "rm -rf /hadoop"
    #删除ambari目录
    ssh $host "rm -rf /var/lib/ambari*"
    ssh $host "rm -rf /var/log/ambari*"
    ssh $host "rm -rf /etc/ambari*"
    ssh $host "rm -rf /var/run/ambari*"
    ssh $host "rm -rf /usr/lib/ambari*"
    #删除安装目录
    ssh $host "rm -rf /usr/hdp"
    #kafka日志目录
    ssh $host "rm -rf /kafka-logs"
    ssh $host "rm -rf /u01/kafka-logs"
    

echo "$logPre======>$host is done! \n"
done

 

posted @ 2022-01-06 16:48  超级无敌小剑  阅读(218)  评论(0编辑  收藏  举报