Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neo4j.exceptions.ServiceUnavailable: Failed to establish connection to IPv4Address(('0.0.0.0', 7687)) #509

Closed
anabapy opened this issue Mar 1, 2021 · 20 comments

Comments

@anabapy
Copy link

anabapy commented Mar 1, 2021

raise ServiceUnavailable("Failed to establish connection to {!r} (reason {})".format(resolved_address, error))\nneo4j.exceptions.ServiceUnavailable: Failed to establish connection to IPv4Address(('0.0.0.0', 7687)) (reason [Errno 111] Connection refused)","statusCode":430

when is use neo4j4.2.3 on tencent cloud function
use bolt drive find Failed to establish connection to IPv4Address(('0.0.0.0', 7687)
when use 127.0.0.1
Failed to establish connection to IPv4Address(('127.0.0.1', 7687)

why?
how to solve it? thank you!

@anabapy anabapy changed the title raise ServiceUnavailable(\"Failed to establish connection to {!r} (reason {})\".format(resolved_address, error))\nneo4j.exceptions.ServiceUnavailable: Failed to establish connection to IPv4Address(('0.0.0.0', 7687)) (reason [Errno 111] Connection refused)","statusCode":430 neo4j.exceptions.ServiceUnavailable: Failed to establish connection to IPv4Address(('0.0.0.0', 7687)) Mar 1, 2021
@robsdedude
Copy link
Member

Hi,

it looks like the driver cannot connect to the server. Please make sure, that you start the driver using the server's public IP address. 0.0.0.0 is definitely not correct. 127.0.0.1 will only work if the driver and the server are running on the same machine.

You can probably find the public IP address of your server somewhere in the tencent admin interface/console.

@robsdedude
Copy link
Member

robsdedude commented Apr 20, 2021

@anabapy, do yo still need assistance on this one?

@LordLean
Copy link

LordLean commented Apr 21, 2021

Hi i'm not sure if similar but I'm trying to establish a connection on my local machine from a Jupyter notebook env using the Python driver.
Using version 4.2.1 and starting from default configuration settings.

Running:
uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=(usr, psd))

It raises the error:
Failed to establish connection to IPv6Address(('::1', 7687, 0, 0)) (reason [Errno 99] Cannot assign requested address)

Following the instructions here: [https://neo4j.com/developer/kb/resolve-python-bolt-driver-error-connection/]
If I change localhost to 127.0.0.1 When I run:
uri = "bolt://127.0.0.1:7687"
driver = GraphDatabase.driver(uri, auth=(usr, psd))

It raises the following error:
ServiceUnavailable: Failed to establish connection to IPv4Address(('127.0.0.1', 7687)) (reason [Errno 111] Connection refused)

If I edit the following parameter in config:
dbms.connector.bolt.listen_address=0.0.0.0:7687
and rerun with localhost: uri = "bolt://localhost:7687"
ServiceUnavailable: Failed to establish connection to IPv6Address(('::1', 7687, 0, 0)) (reason [Errno 99] Cannot assign requested address)

If you have any suggestions how to connect it would be much appreciated. Let me know if I've missed out some useful information for you.

Edit

All fixed it was an error my end! - thanks anyways.

@robsdedude
Copy link
Member

Ok, so I will close this now. If the problem persists, feel free to re-open it, @anabapy

@LordLean, did it have anything to do with how you used the driver? If so, I'd be interested in hearing what the issue was. Just in case someone else has a similar problem in the future.

@LordLean
Copy link

LordLean commented Apr 22, 2021 via email

@anabapy
Copy link
Author

anabapy commented Apr 23, 2021

At present, the problem found is that the cloud function has insufficient memory.

@Naama-shenberger
Copy link

hey, I have the same problem, how do you reconfigure my runtime to be working
locally?

@Naama-shenberger
Copy link

image
image
In the first image, I changed the line in the conf of neo4j to allow a server connection.
And in the second picture, there are still errors
Would appreciate help
Thanks

@robsdedude
Copy link
Member

If you are running your application inside Docker, it will be in its own virtual LAN. Depending on how you start up your neo4j server, you'll have to make sure it's reachable from within the docker container running your application.

Does it work when you start up the application outside docker?

Docs that might help you: https://docs.docker.com/network/

@ellahn3
Copy link

ellahn3 commented Jan 10, 2022

I have the same issue and I don't know what is the problem
image

@robsdedude
Copy link
Member

robsdedude commented Jan 10, 2022

This is shot in the dark: it seems, you're running this Python notebook on a Google server. So localhost will point to what ever server this notebook is running on. Is the database running on the same machine as the notebook?

@ellahn3
Copy link

ellahn3 commented Jan 11, 2022

what does that mean? it doesn't connect through the URL? why is the data relevant, why it has to run on the same machine as the notebook?

@fbiville
Copy link
Contributor

fbiville commented Jan 11, 2022

@ellahn3 your screenshot shows code with the address bolt://localhost:7867. For this code to work, Neo4j must on the same server as this code is running on.
Given it's probably NOT what you want to do, you should update the Neo4j address to the correct one.

@lisalista123
Copy link

Hi @fbiville, what would be the correct address? I'm having the same issue.

@robsdedude
Copy link
Member

robsdedude commented Apr 5, 2022

That depends on where your Neo4j sever is running. It like asking what the right address for a postcard is. That depends on where you want that postcard to be sent to. Or in this case how the Neo4j server is reachable.

I know this is probably not very helpful but there is no way to answer this question without knowing how and where exactly you run the Python code and the database server.

@lisalista123
Copy link

So I'm running my Python code on Google Colab, so using their Google cloud server. I have the Neo4j database stored on my computer, so my issue right now is how to find a way to connect these two.

@robsdedude
Copy link
Member

That's a somewhat not so easy setup. For this to work, you'd need Google's server running Colab to be able to reach your computer. For security and other reasons, your computer is (most likely) not directly reachable from the internet like Google's servers are. Here are a few ideas that might help you find a solution:

  • Use Aura Free (our free cloud hosted database service; comes with some limitations).
  • Use a reverse proxy (like ngrok) to expose the database running on your local machine to the public internet (free options in that area also come with bandwidth or other limitations).
  • Host the database on a proper server that is configured to expose it's service(s) to the public internet.
  • Lastly, probably the easiest: run the Python code on your local machine. For that, you can for instance use jupyter notebooks or plain Python scripts.

@aionicioiu
Copy link

There is also an easy solution using port forwarding with ngrok
ngrok tcp 7687 and local neo4j database can be used in online services like Google Colab, Datalore, etc

@wumirose
Copy link

wumirose commented Jun 5, 2023

image image In the first image, I changed the line in the conf of neo4j to allow a server connection. And in the second picture, there are still errors Would appreciate help Thanks

I am having the exact same error. Any suggestions on the quick fix would be greatly appreciated!

@robsdedude
Copy link
Member

Please see the suggestion in this thread, e.g., #509 (comment) and #509 (comment)

If that doesn't get you anywhere, consider opening a question on stackoverflow, our community forums https://community.neo4j.com/ or such. This issues tracker is generally not the right place for support unless there's a bug or a suspected bug in the driver involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants