Connecting to neo4j on ec2

2019-06-01 14:57发布

I'm trying to connect to my newly setup neo4j

This is how I have configured my neo4j.conf file:

# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
dbms.connectors.default_listen_address=0.0.0.0

# You can also choose a specific network interface, and configure a non-default
# port for each connector, by setting their individual listen_address.

# The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or
# it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for
# individual connectors below.
#dbms.connectors.default_advertised_address=localhost
dbms.connectors.default_advertised_address=xx.xxx.xxx.xxx

# You can also choose a specific advertised hostname or IP address, and
# configure an advertised port for each connector, by setting their
# individual advertised_address.

# Bolt connector
dbms.connector.bolt.enabled=true
#dbms.connector.bolt.tls_level=OPTIONAL
#dbms.connector.bolt.listen_address=:7687

# HTTP Connector. There must be exactly one HTTP connector.
dbms.connector.http.enabled=true
#dbms.connector.http.listen_address=:7474

# HTTPS Connector. There can be zero or one HTTPS connectors.
dbms.connector.https.enabled=true
#dbms.connector.https.listen_address=:7473

(xx.xxx.xxx.xxx being the ip of the day)

In the log It says the remote interface is enabled on port 7474:

2016-12-12 21:17:06.845+0000 INFO  Starting...
2016-12-12 21:17:07.860+0000 INFO  Bolt enabled on 0.0.0.0:7687.
2016-12-12 21:17:10.666+0000 INFO  Started.
2016-12-12 21:17:12.234+0000 INFO  Remote interface available at http://xx.xxx.xxx.xxx:7474/

Using lsof -i -n -P I can see that it is listening:

java     xxxx    root  xxxx  IPv6  xxxxx      0t0  TCP *:7474 (LISTEN)

I did set up a custom tcp rule to allow access from my ip address:

Custom TCP Rule TCP 7474 xxx.xxx.xxx.xxx/xx

I do get it to display in my browser and I get asked to fill in password but when I do I get the following message:

Can not connect to neo4j. Please check your Network Connection.

After a while this one message appears as well:

WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket readyState is: 3

I've tried several different settings but none of them has got me further than this.

The closest thread I've found is this one Neo4j on Amazin EC2 - Not accessible from remote machines but it does not have an answer and concerns another version (using the neo4j-server.properties).

2条回答
一纸荒年 Trace。
2楼-- · 2019-06-01 15:37

Ticking the "Do not use Bolt" option in settings solved the issue.

查看更多
再贱就再见
3楼-- · 2019-06-01 15:51

I just got neo4j to work a few moments ago. for aws ec2 I had to change 2 things:

  1. AWS security groups for the instance

    allow TCP access from anywhere to 7474 and 7687 (just replace the default http port in this aws guide with the neo4j port ) 7474 is for the http request to neo4j and the 7687 was for the bolt.

  2. edit the configurations in the /etc/neo4j/neo4j.conf file

    This config file editing was so confusing. I went through these comments:

    I editted the following:

    • dbms.connectors.default_listen_address=0.0.0.0
    • dbms.connectors.default_advertised_address=<elastic ip> - i just mapped an elastic ip and used it
    • I then set the remaining ports by uncommenting and adding 0.0.0.0 just to be sure (I think the key was using the advertised address)
      • dbms.connector.bolt.enabled=true
      • dbms.connector.bolt.listen_address=0.0.0.0:7687
      • dbms.connector.http.enabled=true
      • dbms.connector.http.listen_address=0.0.0.0:7474
      • dbms.connector.https.enabled=true
      • dbms.connector.https.listen_address=0.0.0.0:7473 The confusing part is the listen_address and advertised_address. my understanding is the latter is used by the neo4j web application javascript to know where to connect and the first one is like setting 0.0.0.0 for mysql to listen as a remote service.

Also I am not sure why you needed nginx; on my end i was just trying to setup neo4j in an aws ec2 instance. Here are some of the neo4j links that helped me setup

Best Regards,

Stevenson Lee

查看更多
登录 后发表回答