neo4j / neo4j-python-driver

Neo4j Bolt driver for Python
https://neo4j.com/docs/api/python-driver/current/
Other
879 stars 186 forks source link

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

Closed anabapy closed 3 years ago

anabapy commented 3 years ago

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!

robsdedude commented 3 years ago

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 commented 3 years ago

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

LordLean commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

No no, I was a fool and hadn't reconfigured my runtime to be working locally, it was still running code in a cloud environment. So no wonder I couldn't connect to my local machine!

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Thu, 22 Apr 2021 at 15:05, Robsdedude @.***> wrote:

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

@LordLean https://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/neo4j/neo4j-python-driver/issues/509#issuecomment-824872000, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOI52XBDY2M4474GZQLOZA3TKAULJANCNFSM4YMCWZ7Q .

anabapy commented 3 years ago

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

Naama-shenberger commented 2 years ago

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

Naama-shenberger commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

robsdedude commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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

robsdedude commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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:

aionicioiu commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Please see the suggestion in this thread, e.g., https://github.com/neo4j/neo4j-python-driver/issues/509#issuecomment-1102159801 and https://github.com/neo4j/neo4j-python-driver/issues/509#issuecomment-1263287676

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.