Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

DNS Resolution: hostname and canonical name for this host are not consistent when checked from a Java process

avatar
Expert Contributor

 

Good morning Community,

i'm suffering of DNS resolution getting the following fatalistic view every time I access to CM:

Juanes_0-1712239324475.png

I'm reading a lot but not getting any robust conclussion of what is the test that concludes in "DNS resolution error". 

it checks "host's hostname and canonical name" but, what does it means? is it the hostname? the name in the /etc/hosts? 

In my case, having

[root@master1 ~]# hostname
master1

[root@master1 ~]# python -c "import socket; print socket.getfqdn(); print socket.gethostbyname(socket.getfqdn())"
master1.domain.net
192.168.0.90

does it means the discrepancy between hostname and socket.getfqdn()?

I can see how many people is getting this error but not a consistent response, could anyone give the solution here? for trying to understand this common issue?

Many thanks in advance.

 

2 ACCEPTED SOLUTIONS

avatar
Master Collaborator

Hello @Juanes 

Thank you for reaching out on this

Can you please confirm what OS version are you using?

Check the output of the following command and see if hostname is the correct one

# hostname -f

If hostname -f is not returning the complete FQDN then please set the FQDN correct and restart the cloudera-scm-agent and you should be good

You might want to check the below discussion

https://community.cloudera.com/t5/Support-Questions/The-hostname-and-canonical-name-for-this-host-ar...

View solution in original post

avatar
Expert Contributor

Hello all,

Finally found the root cause...

/Etc/hosts

192.168.0.10 master1.customerdomain.com

# Hostname

Master1

This is the discrepancy, setting the hostname to the same as shown in /etc/hosts, the issue was solved.

Command used: # hostnamectl set-hostname master1.customerdomain.com

Then restarted the agent daemon and services in the cluster.

Many thanks to the community for so many clues.

View solution in original post

6 REPLIES 6

avatar
Master Collaborator

Hello @Juanes 

Thank you for reaching out on this

Can you please confirm what OS version are you using?

Check the output of the following command and see if hostname is the correct one

# hostname -f

If hostname -f is not returning the complete FQDN then please set the FQDN correct and restart the cloudera-scm-agent and you should be good

You might want to check the below discussion

https://community.cloudera.com/t5/Support-Questions/The-hostname-and-canonical-name-for-this-host-ar...

avatar
Expert Contributor

Hello,

It seems the hostname is not enough, the hostname -f is showing the full name wth fqdn, will continue investigating, tanks

avatar
Super Collaborator

Hi, @Juanes this might also be coming from the DNS side, check the agent logs for any DNS test failures and try to do nslookup from another node to this node IP address and then HQDN and check whether the DNS server is resolving the hostname and IP address correctly or not.

as @upadhyayk04 suggested try the #hostname -f or #hostnamectl commands to get the correct FQDN.

# nslookup <IP-address>/FQDN - if this is not resolving correctly then you may need to check the DNS server whats happening.

avatar
Expert Contributor

Hello, im using rhel8.4 but still the same.

The etc/sysconfig/network file is empty but the network still working, im using the etc/hosts wth ips, fqdn and aliases.

The nslookup is not working, do i must to have a dns server?? I mean, in a local network configuring etc/hosts don't thik so...

Anybody knows how this works and what is the exact commands used for this test? This shouldn't be so difficult, I've read the topics and followed the recommendations but nothing.

Many thanks for your help

 

avatar
Expert Contributor

Hello all,

Finally found the root cause...

/Etc/hosts

192.168.0.10 master1.customerdomain.com

# Hostname

Master1

This is the discrepancy, setting the hostname to the same as shown in /etc/hosts, the issue was solved.

Command used: # hostnamectl set-hostname master1.customerdomain.com

Then restarted the agent daemon and services in the cluster.

Many thanks to the community for so many clues.

avatar
Master Collaborator

Hello,

Thank you for your update

Can you please elaborate more on nslookup not working? Do you mean nslookup command is not available or the command is not returning any output?

 

There is no mandate to have an external DNS server, the entries in /etc/hosts should be enough. What about hostname -f is it working?