neo4j-shell 无法连接到 neo4j 服务器

2023-12-31

我正在使用 neo4j (v3.1.0) 的 docker 版本,并且在使用 neo4j-shell 连接到 neo4j 服务器时遇到困难。

运行实例后neo4r:3.1.0 docker https://hub.docker.com/_/neo4j/,我在容器内运行 bash:

$ docker exec -it neo4j /bin/bash

从那里我尝试运行neo4j-shell像这样:

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

但它错误:

$ /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

我还尝试了其他主机,例如:localhost, 127.0.0.1 and 172.17.0.6(容器IP)。由于它不起作用,我尝试列出容器上的开放端口:

$ 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

正如你所看到的,没有1337打开!我查看了配置文件,指定端口的行被注释掉,这意味着它应该设置为其默认值(1337)。

任何人都可以帮助我使用 neo4j-shell 连接到 neo4j 吗?

顺便说一句,neo4j 服务器已启动并正在运行,我可以通过端口 7474 使用其 Web 访问。


在 3.1 中,默认情况下似乎未启用 shell。

您需要在启用 shell 的情况下传递您自己的配置文件:

取消注释

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

(我发现在 docker 中更改一个值的工作量相当大,但是是的..)

或者使用新的 cypher-shell :

ikwattro@graphaware-team ~> 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
ikwattro@graphaware-team ~> 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>

注意:Cypher-shell 支持begin and 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/ http://neo4j.com/docs/operations-manual/current/tools/cypher-shell/

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

neo4j-shell 无法连接到 neo4j 服务器 的相关文章

  • 一起使用 MongoDB 和 Neo4j

    我正在开始一个新项目 我正在考虑使用 MongoDB 作为文档存储工具 使用 Neo4j 作为映射文档之间关系的机制 然后我想通过 REST API 公开查询结果 人们会说这样做的优点和缺点是什么 是否有更好的方法可以使用不同的 NoSQL
  • 使用 py2neo 将 python 连接到 neo4j 时出错

    我使用 py2neo 将以下 python 代码写入 neo4j from py2neo import Graph from py2neo import neo4j Node Relationship sgraph Graph alice
  • Cypher - 匹配两个不同的可能路径并返回两者

    我有一个数据集 我在这里作为示例表示 http console neo4j org id 3dq78v http console neo4j org id 3dq78v 我想要做的是对于图表中的每个 Z 节点 该示例只有一个 但我有很多 我
  • spring data neo4j 5 - 没有名为“sessionFactory”的bean可用

    我正在使用 spring data neo4j 5 0 7 RELEASE 和 spring 5 0 6 RELEASE 使用文档中的配置https github com spring projects spring data neo4j
  • 使用cypher删除neo4j中的所有节点和关系超出堆空间

    我一直在尝试按照 neo4j google 组和其他在线来源的建议运行此查询 开始 n 节点 匹配 n r 其中 ID n gt 0 删除n r 为了删除测试之间的所有节点和关系 当我从控制台执行此操作时 我用完了 java 堆空间 当我从
  • Neo4j:插入 7k 节点很慢(Spring Data Neo4j / SpringRestGraphDatabase)

    我正在构建一个应用程序 我的用户可以在其中管理字典 其中一项功能是上传文件以初始化或更新词典的内容 我首先关注的结构部分是Dictionary CONTAINS gt Word 从一个空数据库 Neo4j 1 9 4 但也尝试过 2 0 0
  • 如何在neo4j中显示屏幕上的所有节点

    我有近 5000 个节点Recipes和 5 个节点Meal Types在 Neo4j 数据库中 目前他们之间没有任何关系 我正在下面运行 CQL MATCH n RETURN n LIMIT 100000 这运行良好 但它返回与相关的节点
  • 同时运行 Gremlin-Server 和 NEO4J Server

    目前看来我们不能同时运行两者Neo4J服务器 and Gremlin服务器同时 有什么办法可以同时运行两者吗 NEO4J 正在运行 我尝试启动 Gremlin Server 然后出现以下错误 java lang RuntimeExcepti
  • 如何转储 neo4j 图形数据库?

    我将所有数据库存储在一个位置C JATIN DATA 数据库 neo4jDatabases 如何使用 neo4j Desktop 单独转储所有数据库 我已经尝试过 neo4j admin dump database to 这个命令但出现错误
  • with 子句做什么?新4j

    I don t understand what WITH clause do in Neo4j I read the The Neo4j Manual v2 2 2 http neo4j com docs stable query with
  • 在 Ubuntu 中更改 Neo4j 中的数据存储位置

    我已经成功安装了neo4j 端口号为7474 并且工作正常 我的问题是数据存储在 var lib neo4j 该目录中的该位置很快就会满 我想更改数据存储位置 这怎么可能 我尝试编辑该文件 etc neo4j neo4j server pr
  • lucene 如何与 Neo4j 配合使用

    我是新来的Neo4j and Solr Lucene 我读到我们可以在 Neo4j 中使用 lucene 查询 这是如何工作的 Neo4j中使用lucene查询有什么用 我还需要一个建议 我需要编写一个应用程序来搜索和分析数据 which
  • 无法将 neo4j shell 连接到本地服务器

    我已经通过自制程序安装了 neo4j 2 0 0 并启动了服务器 我可以通过端口 7474 访问 webadmin 控制台 但是当我运行时neo4j shell host localhost port 7474 I get non JRMP
  • 如何将map或json对象存储为neo4j中的属性?

    我正在尝试将地图或 json 对象存储为 Neo4j 中的属性 但它不起作用 这是目前节点属性的限制 您有几种解决方法可供选择 您可以将 json 对象转换为字符串并将其保存为属性 您可以使用APOC程序 https neo4j com l
  • 使用 Cypher 向现有节点添加标签

    如何使用 Cypher 查询向现有节点添加标签 这在参考文档中 请参阅http docs neo4j org chunked stable query set html set set a label on a node http docs
  • 我能找到neo4j中两个节点之间的所有关系吗?

    我有一组节点 它们通过以下方式相关 A gt B gt C gt D 该关系是与某个 id 属性的 连接 关系 我的问题是 我可以编写一个 cypher 查询 它将显示从起始节点 A 到起始节点 D 的每个关系的所有 id 属性 而不在查询
  • neo4j - python 驱动程序,服务不可用

    我对 neo4j 非常陌生 我正在尝试建立从 python3 6 到 neo4j 的连接 我已经安装了驱动程序 并且刚刚开始执行第一步 导入请求 导入操作系统 导入时间 导入urllib 从 neo4j v1 导入 GraphDatabas
  • 使用 Cypher 复制不同类型的关系

    我想将现有关系复制到新节点 所有节点都已存在 我想将所有传入关系复制到第二个节点 给定一个节点D和一个像这样的图表 A r gt B lt s C 我想在单个 Cypher 查询中创建以下内容 A r gt B lt s C A r gt
  • 使用 Neo4j 中的索引和 Cypher 进行“IN”子句查询

    我想在 neo4j 中使用 auto index 并传入一个字符串数组进行匹配 我知道您可以在密码查询的末尾添加 IN 子句 但这不使用索引 并且我假设将对所有记录进行数据库扫描 使用索引查询执行此操作的最佳方法是什么 例如假设 faceb
  • 如何在java中使用Liquigraph为Neo4j存储生成索引和约束脚本?

    我正在尝试生成Index and Constraint对于我的弹簧实体 我没有使用 spring data 的任何功能来执行此操作 例如indexes auto assert 如何生成具有以下条件的脚本 我需要在中生成脚本offline模式

随机推荐