You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker环境下Gremlin-Console连接ArcadeDB遇连接拒绝错误

Docker环境下Gremlin-Console连接ArcadeDB失败排查

问题描述

尝试使用Gremlin查询语言访问ArcadeDB数据,但在Docker环境中启动Gremlin-Console并连接ArcadeDB时出现连接拒绝错误。

环境配置

1. ArcadeDB启动命令

docker run --name arcade-db \
            --rm -p 2480:2480 -p 2424:2424 -p 8182:8182 -p 6379:6379 -p 5432:5432 \
           -e JAVA_OPTS="-Darcadedb.server.rootPassword=playwithdata
                          -Darcadedb.server.plugins=GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin
                          -Darcadedb.server.defaultDatabases=Imported[root]{import:https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz}"\
           -d arcadedata/arcadedb:22.8.1

2. Gremlin-Console的Dockerfile

FROM openjdk:8

ARG tinkerpopVersion

WORKDIR /opt
RUN wget https://www.apache.org/dist/tinkerpop/$tinkerpopVersion/apache-tinkerpop-gremlin-console-$tinkerpopVersion-bin.zip
RUN unzip ./apache-tinkerpop-gremlin-console-$tinkerpopVersion-bin.zip
WORKDIR /opt/apache-tinkerpop-gremlin-console-$tinkerpopVersion
COPY arcade-db-remote.yaml /opt/apache-tinkerpop-gremlin-console-$tinkerpopVersion
ENTRYPOINT ["bin/gremlin.sh"]

3. Gremlin-Console配置文件

hosts: [localhost]
port: 8182
connectionPool: { enableSsl: false }
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
              config: { serializeResultToString: true  }}

错误信息

Caused by: java.net.ConnectException: 连接被拒绝
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716)
        at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at java.lang.Thread.run(Thread.java:750)
==>已配置 localhost/127.0.0.1:8182,但当前主机不可用。Gremlin Console 将在每次提交查询时尝试重新连接,不过你可能需要关闭此远程连接并直接排查问题。

排查与解决步骤

  • 修正网络指向:Gremlin-Console容器内的localhost指向容器自身,而非宿主机的ArcadeDB容器。可通过两种方式解决:
    1. 创建自定义Docker网络,启动ArcadeDB时加入该网络并设置别名(如arcade-db),Gremlin-Console容器也加入同一网络,将配置文件中的hosts: [localhost]改为hosts: [arcade-db]。
    2. 使用宿主机实际IP替换配置中的localhost,确保Gremlin-Console能访问到宿主机映射的8182端口。
  • 验证GremlinServer插件加载:查看ArcadeDB容器日志(docker logs arcade-db),确认存在GremlinServerPlugin启动成功的日志,比如"Gremlin Server started on port 8182"。
  • 检查端口映射有效性:在宿主机执行netstat -tulpn | grep 8182,确认8182端口处于监听状态,且被ArcadeDB容器占用。
  • 匹配TinkerPop版本:ArcadeDB 22.8.1兼容TinkerPop 3.5.x版本,构建Gremlin-Console时需指定对应版本(如--build-arg tinkerpopVersion=3.5.3),避免版本不兼容导致连接失败。
  • 等待ArcadeDB完全启动:ArcadeDB导入数据集需要时间,通过docker logs -f arcade-db等待日志显示"ArcadeDB Server is up and running"后,再启动Gremlin-Console进行连接。

内容的提问来源于stack exchange,提问作者rgaponov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 10:05:39