Support Questions

Find answers, ask questions, and share your expertise

java.net.ConnectException: Failed to connect to localhost/127.0.0.1:8081

avatar
Contributor

Hi,

I have a 3 node Nifi Cluster running with and external Zookeeper with

nifi.web.http.port=8081.

and

nifi.web.http.host=<IP of the box>.

The cluster runs fine but suddenly goes down with the below error:


java.net.ConnectException: Failed to connect to localhost/127.0.0.1:8081

On restarting it again starts running fine.

My /etc/hosts file contains:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4


Can someone help?


@Bryan Bende

3 REPLIES 3

avatar
Master Mentor

@siddharth pande

Your error seems to suggest that the nifi cluster is trying to connect to a local zookeeper. Can you add an entry in your /etc/hosts with the IP and FQDN of your remote zk server and the alias like below? I would suggest you comment out the localhost entry.

This entry should be applied to the all the 3 nifi nodes

# 127.0.0.1         localhost localhost.localdomain localhost4 localhost4.localdomain4 
192.168.0.123     remote.zookeer.com   remote

And then restart your Nifi cluster

avatar
Contributor

@Geoffrey Shelton Okot

In that case why would it work fine for sometime before going down?

Also if I comment out 127.0.0.1, the nifi server doesn't start at all.

avatar
New Contributor

Im facing the same issue on my setup as well. I wanted to point my processes to local hosted server and it throws connection exception all the time whereas, when I point to remote server it works absolutely fine. Error is exactly similar to what you have written above. Did you happen to get any solution? @siddharth pande. If yes, please share that would be of great help 🙂