cloudera-agent一键卸载脚本

2023-12-22 18:46:25

#!/bin/bash

# 停止 CDH Agent 服务
echo "停止 CDH Agent 服务..."
sudo service cloudera-scm-agent stop
sudo yum remove cloudera-manager-daemons cloudera-manager-agent

# 删除 CDH Agent 相关文件和目录
echo "删除 CDH Agent 相关文件和目录..."
sudo rm -rf /etc/cloudera-scm-agent
sudo rm -rf /var/lib/cloudera-scm-agent
sudo rm -rf /usr/lib64/cmf/agent

# 清理额外的文件和目录
echo "清理额外的文件和目录..."
sudo rm -rf /etc/security/limits.d/cloudera-scm.conf
sudo rm -rf /etc/systemd/system/multi-user.target.wants/cloudera-scm-agent.service
sudo rm -rf /etc/yum.repos.d/cloudera-manager.repo
sudo rm -rf /etc/default/cloudera-scm-agent
sudo rm -rf /usr/lib/systemd/system/cloudera-scm-agent.service
sudo rm -rf /var/lib/cloudera-scm-server
sudo rm -rf /var/lib/yum/repos/x86_64/7/cloudera-manager
sudo rm -rf /var/cache/yum/x86_64/7/cloudera-manager
sudo rm -rf /var/log/cloudera-scm-agent
sudo rm -rf /opt/cloudera*

echo "删除hadoop 配置目录..."
rm -rf /etc/hadoop
echo "删除hive 配置目录..."
rm -rf /etc/hive
echo "删除sqoop 配置目录..."
rm -rf /etc/sqoop
echo "删除spark 配置目录..."
rm -rf /etc/spark

# 移除 CDH Agent 软件包
echo "卸载 CDH Agent 软件包..."
# 根据你的系统使用相应的包管理命令,例如:
# 如果是 CentOS/RHEL
sudo yum remove -y cloudera-scm-agent
# 如果是 Ubuntu/Debian
# sudo apt-get remove -y cloudera-scm-agent

# 删除 CDH Agent 用户和组
echo "删除 CDH Agent 用户和组..."
sudo userdel cloudera-scm
sudo groupdel cloudera-scm

echo "CDH Agent 卸载完成."
echo "=========需要重启系统========="
?

文章来源:https://blog.csdn.net/anguoan/article/details/135154475
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。