Cassandra 中 JanusGraph 的顶点在哪里?

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

Apache Cassandra 把它的JanusGraph Vertexes放在哪里?

绝不是专家问题,我是新手,我知道。在某些地方也生锈了。
我是 JanusGraph、Cassandra 的初学者,并在 Stack Overflow 上提问。
作为专家工程师和开发人员或经验丰富且始终如一的 Stack Overflow 作者,我的经验还远远不够。

复制步骤:

  1. 创建并启动一个 Cassandra [Docker 容器]
    docker run --name jg-cassandra -d -e CASSANDRA_START_RPC=true -p 9160:9160 -p 9042:9042 -p 7199:7199 -p 7001:7001 -p 7000:7000 cassandra:3.11
    
  2. 创建并运行这个 Java + Maven 项目(代码如下)
  3. 结果
    1. 预期:像 OrientDB 或 Neo4j 这样的东西有一个顶点表可以从中读取
    2. 实际上:找不到像
      V
      vertex
      这样的名字

Cassandra [Docker container] Terminal

cqlsh> desc keyspaces;

system_schema  system      system_distributed
system_auth    janusgraph  system_traces     

cqlsh> use janusgraph;

cqlsh:janusgraph> desc tables

edgestore_lock_  graphindex_lock_         janusgraph_ids   
txlog            systemlog                graphindex       
edgestore        system_properties_lock_  system_properties

Log4j2 STOUT Logs

2023-05-09 11:01:53,970 [INFO] [c.d.o.d.i.c.ContactPoints.main] ::   Contact point localhost:9042 resolves to multiple addresses, will use them all ([localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1])
2023-05-09 11:01:54,072 [INFO] [c.d.o.d.i.c.DefaultMavenCoordinates.main] ::     DataStax Java driver for Apache Cassandra(R) (com.datastax.oss:java-driver-core) version 4.15.0
2023-05-09 11:01:54,652 [INFO] [c.d.o.d.i.c.t.Clock.JanusGraph Session-admin-0] ::   Using native clock for microsecond precision
2023-05-09 11:01:54,967 [WARN] [c.d.o.d.i.c.l.h.OptionalLocalDcHelper.JanusGraph Session-admin-0] ::     [JanusGraph Session|default] You specified datacenter1 as the local DC, but some contact points are from a different DC: Node(endPoint=localhost/[0:0:0:0:0:0:0:1]:9042, hostId=null, hashCode=7b9f753a)=null; please provide the correct local DC, or check your contact points
2023-05-09 11:01:55,209 [INFO] [o.j.g.i.UniqueInstanceIdRetriever.main] ::   Generated unique-instance-id=c0a8563c1700-rmt-lap-win201
2023-05-09 11:01:55,231 [INFO] [c.d.o.d.i.c.ContactPoints.main] ::   Contact point localhost:9042 resolves to multiple addresses, will use them all ([localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1])
2023-05-09 11:01:55,265 [INFO] [c.d.o.d.i.c.t.Clock.JanusGraph Session-admin-0] ::   Using native clock for microsecond precision
2023-05-09 11:01:55,322 [WARN] [c.d.o.d.i.c.l.h.OptionalLocalDcHelper.JanusGraph Session-admin-0] ::     [JanusGraph Session|default] You specified datacenter1 as the local DC, but some contact points are from a different DC: Node(endPoint=localhost/127.0.0.1:9042, hostId=null, hashCode=1dc6cab9)=null; please provide the correct local DC, or check your contact points
2023-05-09 11:01:55,341 [INFO] [o.j.d.c.ExecutorServiceBuilder.main] ::  Initiated fixed thread pool of size 40
2023-05-09 11:01:55,447 [INFO] [o.j.g.d.StandardJanusGraph.main] ::  Gremlin script evaluation is disabled
2023-05-09 11:01:55,473 [INFO] [o.j.d.l.k.KCVSLog.main] ::   Loaded unidentified ReadMarker start time 2023-05-09T16:01:55.473310Z into org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller@ff23ae7

Process finished with exit code 0

代码

Main.java
简化

import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphVertex;
import org.janusgraph.core.PropertyKey;
import org.janusgraph.core.schema.JanusGraphManagement;

public class Main {
    public static void main(String[] args) {
        JanusGraph janusGraph = JanusGraphFactory.build().set("storage.backend", "cql").set("storage.hostname", "localhost:9042").open();
        JanusGraphManagement janusGraphManagement = janusGraph.openManagement();
        PropertyKey propertyKey = janusGraphManagement.getOrCreatePropertyKey("_id");
        janusGraphManagement.commit();
        JanusGraphVertex janusGraphVertex = janusGraph.addVertex();
        janusGraphVertex.property("test","test");
        janusGraph.tx().commit();
        janusGraphVertex = janusGraph.addVertex();
        janusGraphVertex.property("test","test2");
        janusGraph.tx().commit();
        janusGraph.close();
    }
}

pom.xml
片段

    <dependencies>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j2-impl</artifactId>
            <version>2.20.0</version>
        </dependency>
        <dependency>
            <groupId>org.janusgraph</groupId>
            <artifactId>janusgraph-cql</artifactId>
            <version>1.0.0-20230504-014643.988c094</version>
        </dependency>
    </dependencies>

log4j2.xml
专注

<Configuration>
    <Appenders>
        <Console name="STDOUT" target="SYSTEM_OUT">
            <PatternLayout>
                <Pattern>%d [%p] [%c{1.}.%t] ::&#x09; %m%n</Pattern>
            </PatternLayout>
        </Console>
    </Appenders>
    <Loggers>
        <Root level="info">
            <AppenderRef ref="STDOUT"/>
        </Root>
    </Loggers>
</Configuration>
gremlin cassandra-3.0 janusgraph cqlsh java-17
1个回答
0
投票

正如您所注意到的,JanusGraph 在启动时会创建多个表。所有主要图形数据都存储为

edgestore
表中的宽行。但是,这些表在很大程度上是不透明的 blob,您将无法从 CQL 中有意义地查询它们。

edgestore
表的构建方式在here

中进行了讨论
© www.soinside.com 2019 - 2024. All rights reserved.