原文出处:https://www.cnblogs.com/blazer/p/9297025.html
遇到一个奇怪的情况:
解决方案:先停止bizdata02机器的agent,然后删除元数据表中记录的HOSTS数据。由于我们集群使用mysql存储元数据,给出以下mysql操作示例。
步骤如下:
1. 停止agent
sh /opt/cm-5.13.1/etc/init.d/cloudera-scm-agent stop
2. 找到重复HOST_ID,ID越大,说明是后来CDH加入的。
select * from `HOSTS`;
3. 由于删除HOSTS表有依赖,设置好@id之后执行级联删除。
set @id := 10; delete from COMMANDS_DETAIL WHERE COMMAND_ID in (select COMMAND_ID from COMMANDS where HOST_ID=@id); delete from COMMANDS WHERE HOST_ID=@id; delete from `HOSTS` WHERE HOST_ID=@id;
4. 启动agent
sh /opt/cm-5.13.1/etc/init.d/cloudera-scm-agent start
5. 好了。
完毕,回家睡觉。