2017-02-03 3 views
2

Ich benutze Docker-Version von neo4j (v3.1.0) und ich habe Schwierigkeiten mit Neo4j-Server mit neo4j-Shell verbinden.neo4j-shell kann keine Verbindung zu neo4j Server

Nachdem eine Instanz von läuft docker, betreibe ich ein Bash im Inneren des Behälters:

$ docker exec -it neo4j /bin/bash 

Und von dort Ich versuche, die neo4j-shell wie dies auszuführen:

/var/lib/neo4j/bin/neo4j-shell 

Aber es Fehler:

$ /var/lib/neo4j/bin/neo4j-shell 
ERROR (-v for expanded information): 
    Connection refused 

-host  Domain name or IP of host to connect to (default: localhost) 
-port  Port of host to connect to (default: 1337) 
-name  RMI name, i.e. rmi://<host>:<port>/<name> (default: shell) 
-pid  Process ID to connect to 
-c   Command line to execute. After executing it the shell exits 
-file  File containing commands to execute, or '-' to read from stdin. After executing it the shell exits 
-readonly Connect in readonly mode (only for connecting with -path) 
-path  Points to a neo4j db path so that a local server can be started there 
-config Points to a config file when starting a local server 

Example arguments for remote: 
    -port 1337 
    -host 192.168.1.234 -port 1337 -name shell 
    -host localhost -readonly 
    ...or no arguments for default values 
Example arguments for local: 
    -path /path/to/db 
    -path /path/to/db -config /path/to/neo4j.config 
    -path /path/to/db -readonly 

Ich habe auch andere versucht Hosts wie: localhost, 127.0.0.1 und 172.17.0.6 (der Container IP). Da es nicht funktioniert habe ich auf meinem Behälter offene Ports zur Liste versucht:

$ netstat -l 
Active Internet connections (only servers) 
Proto Recv-Q Send-Q Local Address   Foreign Address   State  
tcp  0  0 :::7687     :::*     LISTEN  
tcp  0  0 :::7473     :::*     LISTEN  
tcp  0  0 :::7474     :::*     LISTEN  
Active UNIX domain sockets (only servers) 
Proto RefCnt Flags  Type  State   I-Node Path 

Wie Sie sehen, gibt es keine 1337 offen! Ich habe in die Konfigurationsdatei geschaut und die Zeile zum Spezifizieren von Port ist auskommentiert, was bedeutet, dass sie auf ihren Standardwert (1337) gesetzt werden sollte.

Kann mir jemand helfen, neo4j-Shell mit neo4j zu verbinden?

BTW, der neo4j-Server läuft und ich kann seinen Web-Zugriff über Port: 7474 verwenden.

Antwort

6

In 3.1 scheint es, dass die Shell nicht standardmäßig aktiviert ist.

Sie benötigen, um Ihre eigene Konfigurationsdatei mit der Shell aktiviert weitergeben müssen:

Kommentar-

# Enable a remote shell server which Neo4j Shell clients can log in to. 
dbms.shell.enabled=true 

(ich die Menge der Arbeiter finden für einen Wert in Docker ziemlich schwer zu ändern, aber yeah ..)

Oder nutzen Sie den neuen Chiffre-Shell:

[email protected] ~> docker ps -a | grep 'neo4j' 
34b3c6718504  neo4j:3.1.0    "/docker-entrypoint.s" 2 minutes ago  Up 2 minutes     7473-7474/tcp, 7687/tcp compassionate_easley 
2395bd0b1fe9  neo4j:3.1.0    "/docker-entrypoint.s" 5 minutes ago  Exited (143) 3 minutes ago        cranky_goldstine 
949feacbc0f9  neo4j:3.1.0    "/docker-entrypoint.s" 5 minutes ago  Exited (130) 5 minutes ago        modest_boyd 
c38572b078de  neo4j:3.0.6-enterprise "/docker-entrypoint.s" 6 weeks ago   Exited (0) 6 weeks ago         fastfishpim_neo4j_1 
[email protected] ~> docker exec --interactive --tty compassionate_easley bin/cypher-shell 
username: neo4j 
password: ***** 
Connected to Neo4j 3.1.0 at bolt://localhost:7687 as user neo4j. 
Type :help for a list of available commands or :exit to exit the shell. 
Note that Cypher queries must end with a semicolon. 
neo4j> 

NB: Cypher-Shell unterstützt begin und commit:

neo4j> :begin 
neo4j# create (n:Node); 
Added 1 nodes, Added 1 labels 
neo4j# :commit; 
neo4j> 

-

neo4j> :begin 
neo4j# create (n:Person {name:"John"}); 
Added 1 nodes, Set 1 properties, Added 1 labels 
neo4j# :rollback 
neo4j> :commit 
There is no open transaction to commit 
neo4j> 

http://neo4j.com/docs/operations-manual/current/tools/cypher-shell/

+0

Danke, aber ich bin interessiert an 'noe4j-shell' meist, da es' BEGIN' unterstützt, COMMIT 'und Transaktionen. Es scheint, Chiffre-Shell nicht. Könnten Sie mir bitte sagen, welcher Eintrag in der Konfiguration die neo4j-Shell steuert? – Mehran

+0

Fair genug, habe ich meine Antwort mit der Zeile –

+1

geändert Beachten Sie, dass Chiffre-Shell unterstützt beginnen und commit, fügte ein Beispiel hinzu –

Verwandte Themen