ArcadeDB | `由于之前的异常,所有主机均被视为不可用。检查错误日志以查找实际原因。`

问题描述 投票:0回答:1

您的问题详情是什么?

为什么 Tinkerpop-Gremlin

AnonymousTraversalSource
发现 ArcadeDB 不可用?

我查看了

log/arcadedb.log.x
文件,但它们是空的。 Log4j2 日志也不包含任何进一步的信息。 我可能只是没有在互联网搜索和人工智能中输入正确的关键字和/或措辞来寻求帮助。

Exception in thread "main" java.lang.IllegalStateException: org.apache.tinkerpop.gremlin.process.remote.RemoteConnectionException: org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException: All hosts are considered unavailable due to previous exceptions. Check the error log to find the actual reason.
...
Caused by: org.apache.tinkerpop.gremlin.process.remote.RemoteConnectionException: org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException: All hosts are considered unavailable due to previous exceptions. Check the error log to find the actual reason.

我知道这是一个新手问题。我只是无法完全连接转换这个点。
也许它已经在文档中,但我误解了或没有意识到它所说的就是我正在寻找的内容。 我只是还没有经验,也没有完全充实的例子可供学习。

您尝试了什么以及您期待什么?

我可以使用 ArcadeDB 文档的固定示例获取顶点和边。

    public static void main(String[] args) throws IOException, CsvValidationException {
        DatabaseFactory databaseFactory = new DatabaseFactory("/databases/mydb");
        Database database = databaseFactory.open();
        database.begin();
//        database.command("sql", "create vertex type User");
//        MutableVertex elon = db.newVertex("User", "name", "Elon", "lastName", "Musk");
        MutableVertex elon = database.newVertex("User");
        elon.set("name", "Elon").set("lastName", "Musk").save();
//        MutableVertex steve = db.newVertex("User", "name", "Steve", "lastName", "Jobs");
        MutableVertex steve = database.newVertex("User");
        steve.set("name", "Steve").set("lastName", "Jobs").save();
//        database.command("sql", "create edge type IsFriendOf");
        elon.newEdge("IsFriendOf", steve, true, "since", 2010);
        database.commit();
        database.close();
    }

现在我只想将其切换到 Tinkerpop-Gremlin,以便在我测试和比较图形数据库 (GDB) 时更加标准。 我已经有了一个学习曲线,只是在 GDB 之间获取可重复的示例和调整调整,因为我还没有经历过一切都是完全 1-2-1 的。 但是,我什至似乎无法使用

DriverRemoteConnection
连接到(ArcadeDB-Plugin?)Gremlin-Server(?)。 我尝试使用不同的端口,以防我误读或文档未更新到最新设置。 但这次没用。

错误输出

Exception in thread "main" java.lang.IllegalStateException: org.apache.tinkerpop.gremlin.process.remote.RemoteConnectionException: org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException: All hosts are considered unavailable due to previous exceptions. Check the error log to find the actual reason.
    at org.apache.tinkerpop.gremlin.process.remote.traversal.step.map.RemoteStep.promise(RemoteStep.java:97)
    at org.apache.tinkerpop.gremlin.process.remote.traversal.step.map.RemoteStep.processNextStart(RemoteStep.java:65)
    at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:135)
    at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:40)
    at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.next(DefaultTraversal.java:249)
        ...
Caused by: org.apache.tinkerpop.gremlin.process.remote.RemoteConnectionException: org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException: All hosts are considered unavailable due to previous exceptions. Check the error log to find the actual reason.
    at org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection.submitAsync(DriverRemoteConnection.java:231)
    at org.apache.tinkerpop.gremlin.process.remote.traversal.step.map.RemoteStep.promise(RemoteStep.java:89)
    ... 5 more
Caused by: org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException: All hosts are considered unavailable due to previous exceptions. Check the error log to find the actual reason.

只有两行代码

        GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using("localhost", 8182, "g"));
        logger.info(g.V().next());

ArcadeDB-Gremlin-Docker 容器的部署脚本

docker run -d -p 2480:2480 -p 2424:2424 -p 6379:6379 -p 5432:5432 -p 8182:8182
    --env JAVA_OPTS="-Darcadedb.server.rootPassword=playwithdata -Darcadedb.server.defaultDatabases=Imported[root]{import:https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz} 
    -Darcadedb.server.plugins=Redis:com.arcadedb.redis.RedisProtocolPlugin,MongoDB:com.arcadedb.mongo.MongoDBProtocolPlugin,Postgres:com.arcadedb.postgres.PostgresProtocolPlugin,GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin" 
    arcadedata/arcadedb

我漏读或误读了哪些额外步骤?

gremlin tinkerpop3 graph-traversal remote-connection arcadedb
1个回答
0
投票

您需要执行以下操作才能使用 Gremlin 连接到 ArcadeDB,示例代码:

public static Cluster connectToDatabase() {
    return Cluster.build()
            .port(8182)
            .addContactPoint("localhost")
            .credentials("root", "playwithdata")
            .create();
}
© www.soinside.com 2019 - 2024. All rights reserved.