1、在CM上看到有告警
DNS Resolution
The hostname and canonical name for this host are not consistent when checked from a Java process.
2、从服务器上看cm-agent的日志
看起来是长短主机名不一致
[09/Mar/2023 12:50:15 +0800] 26436 DnsResolutionMonitor throttling_logger WARNING (59 skipped) hostname xxxxxx differs from the canonical name xxxxx.xxx.xxxx.com
3、使用py和java命令获取主机名
java -classpath /opt/cloudera/cm/lib/agent-7.6.1.jar com.cloudera.cmon.agent.DnsTest
python -c 'import socket; print socket.getfqdn(), socket.gethostbyname(socket.getfqdn())'
可以看到代码获取的主机名
4、解决
一般进行主机名的修改
要求:hostname的设置和DNS解析名的设置要保持一致,都使用FQDN
操作步骤见官方文档:
https://docs.cloudera.com/cdp-private-cloud-base/7.1.7/installation/topics/cdpdc-configure-network-names.html