Skip to main content
Kou_Bou
Silver ⭐️⭐️⭐️
Nov 6, 2019 9:25 AM UTC
Solved

Sujet : Failed to connect to https://localhost:8440/ca due to [Errno 111] Connection refused, Server at https://localhost:8440 is not reachable, sleeping for 10 seconds...

Hello ,
I installed Ambari server and Ambari agent but I have  ten day that I try to connect ,I receive this error in ambari-agent.log: 

INFO 2019-11-06 09:46:39,682 NetUtil.py:62 - Connecting to https://localhost:8440/ca
WARNING 2019-11-06 09:46:39,683 NetUtil.py:93 - Failed to connect to https://localhost:8440/ca due to [Errno 111] Connection refused
WARNING 2019-11-06 09:46:39,683 NetUtil.py:116 - Server at https://localhost:8440 is not reachable, sleeping for 10 seconds...
INFO 2019-11-06 09:46:49,683 NetUtil.py:62 - Connecting to https://localhost:8440/ca
WARNING 2019-11-06 09:46:49,684 NetUtil.py:93 - Failed to connect to https://localhost:8440/ca due to [Errno 111] Connection refused
WARNING 2019-11-06 09:46:49,685 NetUtil.py:116 - Server at https://localhost:8440 is not reachable, sleeping for 10 seconds...

 And in Ambari-server I have: 

05 Nov 2019 11:28:49,329 INFO [ambari-hearbeat-monitor] TopologyManager:487 - Hearbeat for host localhost.localdomain lost thus removing it from available hosts.
05 Nov 2019 11:39:58,408 WARN [qtp-ambari-agent-106] SecurityFilter:103 - Request https://localhost:8440/ca doesn't match any pattern.
05 Nov 2019 11:39:58,409 WARN [qtp-ambari-agent-106] SecurityFilter:62 - This request is not allowed on this port: https://localhost:8440/ca
05 Nov 2019 11:40:00,783 INFO [qtp-ambari-agent-106] HeartBeatHandler:425 - agentOsType = centos7
05 Nov 2019 11:40:00,787 INFO [qtp-ambari-agent-106] HostImpl:294 - Received host registration, host=[hostname=sqlcls,fqdn=sqlcls.yacine.lab,domain=yacine.lab,architecture=x86_64,processorcount=4,physicalprocessorcount=4,osname=centos,osversion=7.7.1908,osfamily=redhat,memory=16266600,uptime_hours=79,mounts=(available=8121532,mountpoint=/dev,used=0,percent=0%,size=8121532,device=devtmpfs,type=devtmpfs)(available=8133300,mountpoint=/dev/shm,used=0,percent=0%,size=8133300,device=tmpfs,type=tmpfs)(available=8124108,mountpoint=/run,used=9192,percent=1%,size=8133300,device=tmpfs,type=tmpfs)(available=47411672,mountpoint=/,used=4991528,percent=10%,size=52403200,device=/dev/mapper/centos-root,type=xfs)(available=786336,mountpoint=/boot,used=252000,percent=25%,size=1038336,device=/dev/sda1,type=xfs)(available=147866840,mountpoint=/home,used=33004,percent=1%,size=147899844,device=/dev/mapper/centos-home,type=xfs)(available=1626660,mountpoint=/run/user/0,used=0,percent=0%,size=1626660,device=tmpfs,type=tmpfs)]
, registrationTime=1572950400783, agentVersion=2.4.0.1
05 Nov 2019 11:40:00,799 INFO [qtp-ambari-agent-106] TopologyManager:408 - TopologyManager.onHostRegistered: Entering
05 Nov 2019 11:40:00,800 INFO [qtp-ambari-agent-106] TopologyManager:469 - TopologyManager: Queueing available host sqlcls.yacine.lab
05 Nov 2019 13:17:32,311 WARN [Thread-2] QueuedThreadPool:145 - 1 threads could not be stopped
05 Nov 2019 13:17:32,311 WARN [Thread-2] QueuedThreadPool:145 - 1 threads could not be stopped
05 Nov 2019 13:17:32,311 INFO [main] AmbariServer:631 - Joined the Server

Any ideas please I have tried a lot of solution but the problem still persists?

 

Thank you

 

jsensharma
Platinum ⭐️⭐️
Nov 6, 2019 11:43 AM UTC

@Kou_Bou 

As we see that you are getting following kind of error "certificate_unknown" in AmbariServer logs

06 Nov 2019 12:06:35,805 WARN [qtp-ambari-agent-68] nio:720 - javax.net.ssl.SSLException: Received fatal alert: certificate_unknown
06 Nov 2019 12:06:35,904 WARN [qtp-ambari-agent-67] SecurityFilter:103 - Request <a href="https://192.168.253.45:8440/" target="_blank">https://192.168.253.45:8440/</a> doesn't match any patter

Hence you should try to delete the OLD certificates from agent machine and then try again. As the old Agent certificates might be having incorrect names.

# rm /var/lib/ambari-agent/keys/*
# ambari-agent restart

While restarting it should fetch correct certificates from ambari server.


.

.
If your question is answered then, Please make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

7 replies

jsensharma
Platinum ⭐️⭐️
Platinum ⭐️⭐️
Nov 6, 2019 9:35 AM UTC

@Kou_Bou 

 

As we see the following message:

WARNING 2019-11-06 09:46:39,683 NetUtil.py:93 - Failed to connect to https://localhost:8440/ca due to [Errno 111] Connection refused

Which indicates that the Ambari Agent is trying to conect to the AmbariServer running in Localmachine "localhost". Ideally it should be using the FQDN of ambari server instead of "localhost:8440".

So can you please try this:

1). please edit the "/etc/ambari-agent/conf/ambari-agent.ini" hostname to point to the FQDN (fully Qualified Hostname) of AmbariServer instead of localhost. 

Please make sure to replace the "ambariserverhost.example.com" with the actual FQDN of your ambari server.   

Example:

 

# grep -A1 '\[server\]' /etc/ambari-agent/conf/ambari-agent.ini
[server]
hostname=ambariserverhost.example.com

 

2. Then restart Ambari Agent.

 

# ambari-agent restart

# cat /etc/hosts

 


3. Now verify iof you are able to connect to the mentioned AmbariServer FQDN and Port from the agent machine as following?

 

# telnet ambariserverhost.example.com 8440
(OR)
# nc -v ambariserverhost.example.com 8440

 


4. Also please make sure that the iptables/firewall is disabled on AmbariServer host and port 8440 is listening

Example:

 

# netstat -tnlpa | grep `cat /var/run/ambari-server/ambari-server.pid`
tcp6 0 0 :::8080 :::* LISTEN 7463/java
tcp6 0 0 :::8440 :::* LISTEN 7463/java

 

 

.

 

Translate
Kou_Bou
Kou_BouAuthor
Silver ⭐️⭐️⭐️
Nov 6, 2019 10:38 AM UTC

Thank you for your answer @jsensharma 

 You find here the result of the steps that you mentioned:  

1-

[root@localhost /]# grep -A1 '\[server\]' /etc/ambari-agent/conf/ambari-agent.ini

[server]

hostname=localhost

2- 

[root@localhost /]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.253.46 pocserver2 pocserver2

192.168.253.47 pocserver3 pocserver3

192.168.253.45 localhost localhost

3- 

[root@localhost /]# nc -v localhost 8440

Ncat: Version 7.50 ( https://nmap.org/ncat )

Ncat: Connected to ::1:8440.

And it is blocked here without another output

4- 

[root@localhost /]#  netstat -tnlpa | grep `cat /var/run/ambari-server/ambari-server.pid`

tcp6       0      0 :::8440                 :::*                    LISTEN      32030/java

tcp6       0      0 :::8441                 :::*                    LISTEN      32030/java

tcp6       0      0 :::8443                 :::*                    LISTEN      32030/java

Translate
jsensharma
Platinum ⭐️⭐️
Platinum ⭐️⭐️
Nov 6, 2019 10:43 AM UTC

@Kou_Bou 

 

Your "/etc/hosts" file should have the FQDN info of AmbariServer  (do not use localhost) to point to ambari server.

 

Also please change the "ambari-agent.ini" to point to the  AmbariServer FQDN instead of using "localhost"

 

https://docs.cloudera.com/HDPDocuments/Ambari-2.7.4.0/administering-ambari/content/amb_install_the_ambari_agents_manually_on_rhel-centos-oracle_7.html

 

 

On each Agent node, stop the Agent.
# ambari-agent stop

Using a text editor, edit /etc/ambari-agent/conf/ambari-agent.ini to point to the new host.

[server]
hostname=$NEW FULLY.QUALIFIED.DOMAIN.NAME
url_port=8440
secured_url_port=8441

 

 

 

 

.

Translate