Cypher-shell works remotely but not locally

I'm running 4.1 enterprise using the latest EC2 AMI (ami-0afe90add2767a91c).
When I ssh in, I'm unable to connect using cypher-shell locally:

$ cypher-shell -u neo4j -p -----------
Unable to connect to localhost:7687, ensure the database is running and that there is a working network connection to it.

But I can connect remotely and successfully query via the data browser or using cypher-shell:

$ cypher-shell -a --.--.--.-- -u neo4j -p ------------

So I'm pretty sure that there's a connection and the database is working.

Any suggestions much appreciated.

I noticed that the journal indicates:

Bolt enabled on --.--.--.--:7687.

I found that I can indeed connect locally using that address. But I don't see reference to the need to do that in the documentation. Is this something new or related to the AMI?

Change the config to

dbms.default_listen_address=0.0.0.0
dbms.connector.bolt.listen_address=:7687

or

dbms.connector.bolt.listen_address=0.0.0.0:7687

When you give a specific IP address the server will bind to only that IP address. By specifying 0.0.0.0, the server will try to bind to all the available network addresses of the server.

1 Like

First, thanks @anthapu!

I'm actually having trouble changing the config.

It seems that with a VM one cannot modify neo4j.conf directly, but rather neo4j.template, as shown here: https://neo4j.com/developer/neo4j-cloud-vms/?_ga=2.135710324.430004693.1598163081-2144556406.1588766564.

The template contains this line:

dbms.default_listen_address=$dbms_default_listen_address

Based on the documentation link above, I understand that it should be possible to modify the value of $dbms_default_listen_address by using a VM tag. This is an EC2 instance, so I set the tag per https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html. Specifically, I created a tag with the name "dbms.default_listen_address" and a value of "0.0.0.0".

But even after rebooting, neo4j.conf is being generated as before.

Of course, I could just hard-code "0.0.0.0" into the template. But that would defeat the purpose of a template.

Does anyone know what I have to do to set this VM tag correctly? Or barring that, from where the default value is being set if there is no tag?

As per documentation in the link provided I think you need to provide the tag as

dbms_default_listen_address=0.0.0.0

Since that is the value template is looking for

dbms.default_listen_address=$dbms_default_listen_address

where as you are creating tag as

Specifically, I created a tag with the name "dbms.default_listen_address" and a value of "0.0.0.0".

You are using "dbms." change it to "dbms_" and try.

Thanks again @anthapu. Yes, you caught an error there. But changing it still doesn't seem to have an impact. I've asked the question also here: NEO4J ENTERPRISE: neo4j.conf gets overwritten.