Search code examples
dockerneo4jgraphenedb

cycli fails to connect a docker neo4j database


I have set up a docker neo4j image:

2017-11-02 03:29:49.000+0000 INFO  ======== Neo4j 3.2.5 ========
2017-11-02 03:29:49.037+0000 INFO  Starting...
2017-11-02 03:29:50.527+0000 INFO  Bolt enabled on 0.0.0.0:7687.
2017-11-02 03:29:54.338+0000 INFO  Started.
2017-11-02 03:29:55.744+0000 INFO  Remote interface available at http://localhost:7474/

The port mapping is:

7473/tcp    localhost:32770
7474/tcp    localhost:32769
7687/tcp    localhost:32768

I am able to connect the browser via http://localhost:32769/browser/

Now I want to access it by cycli, but failed:

Jimmys-MBP:scripts jimmy$ cycli -u neo4j -p xxxxx -h localhost -P 32769
 ______     __  __     ______     __         __
/\  ___\   /\ \_\ \   /\  ___\   /\ \       /\ \
\ \ \____  \ \____ \  \ \ \____  \ \ \____  \ \ \
 \ \_____\  \/\_____\  \ \_____\  \ \_____\  \ \_\
  \/_____/   \/_____/   \/_____/   \/_____/   \/_/
Cycli version: 0.7.6
Neo4j version: 3.2.5
Bug reports: https://github.com/nicolewhite/cycli/issues

> match(n) return n;
Unable to connect to localhost on port 7687 - is the server running?

Why is it still looking for docker port 7687?


Solution

  • It is most likely that source of the problem is following configuration parameter in neo4j.conf

    dbms.connector.bolt.listen_address=0.0.0.0:7687
    

    Due to the fact you redirect port 7687 using docker port mapping

    7687/tcp    localhost:32768
    

    you should also modify bove config to make sure neo4j advertise port 32768 instead default port 7687.

    Accorng to the documentation that could be achieved environment variable when staring docker conatiner with following command

    sudo docker run -d --publish=32769:7474 --publish=32768:32768 --env=NEO4J_AUTH=neo4j/neo4jadmin  --env=NEO4J_dbms_connector_bolt_listen__address=0.0.0.0:32768 --name cycli_test_neo4j neo4j 
    

    However, there is this bug in cycli which needs to be resolved for all this to work.