我可以使用 docker compose 在本地启动 janusgraph/janusgraph 容器。
一切都很好,直到我将
allow-custom-vid-types
env 设置为 true,这使得容器无法启动并显示以下日志
2023-12-14 16:08:29 waiting for storage...
2023-12-14 16:08:44 waiting for storage...
2023-12-14 16:09:00 waiting for storage...
2023-12-14 16:09:15 waiting for storage...
2023-12-14 16:09:19 /etc/opt/janusgraph/janusgraph-server.yaml will be used to start JanusGraph Server in foreground
2023-12-14 16:09:21 SLF4J: Class path contains multiple SLF4J bindings.
2023-12-14 16:09:21 SLF4J: Found binding in [jar:file:/opt/janusgraph/lib/log4j-slf4j-impl-2.20.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
2023-12-14 16:09:21 SLF4J: Found binding in [jar:file:/opt/janusgraph/lib/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
2023-12-14 16:09:21 SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
2023-12-14 16:09:21 SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
2023-12-14 16:09:21 16:09:21 INFO org.janusgraph.graphdb.server.JanusGraphServer.printHeader -
2023-12-14 16:09:21 mmm mmm #
2023-12-14 16:09:21 # mmm m mm m m mmm m" " m mm mmm mmmm # mm
2023-12-14 16:09:21 # " # #" # # # # " # mm #" " " # #" "# #" #
2023-12-14 16:09:21 # m"""# # # # # """m # # # m"""# # # # #
2023-12-14 16:09:21 "mmm" "mm"# # # "mm"# "mmm" "mmm" # "mm"# ##m#" # #
2023-12-14 16:09:21 #
2023-12-14 16:09:21 "
2023-12-14 16:09:21
2023-12-14 16:09:21 16:09:21 INFO com.jcabi.log.Logger.infoForced - 106 attributes loaded from 339 stream(s) in 51ms, 106 saved, 5377 ignored: ["Agent-Class", "Ant-Version", "Archiver-Version", "Automatic-Module-Name", "Bnd-LastModified", "Build-Date", "Build-Date-UTC", "Build-Id", "Build-Java-Version", "Build-Jdk", "Build-Jdk-Spec", "Build-Number", "Build-Tag", "Build-Timezone", "Build-Version", "Built-By", "Built-JDK", "Built-OS", "Built-Status", "Bundle-ActivationPolicy", "Bundle-Activator", "Bundle-Category", "Bundle-ClassPath", "Bundle-Classpath", "Bundle-ContactAddress", "Bundle-Copyright", "Bundle-Description", "Bundle-Developers", "Bundle-DocURL", "Bundle-License", "Bundle-ManifestVersion", "Bundle-Name", "Bundle-NativeCode", "Bundle-RequiredExecutionEnvironment", "Bundle-SCM", "Bundle-SymbolicName", "Bundle-Vendor", "Bundle-Version", "Can-Redefine-Classes", "Can-Retransform-Classes", "Can-Set-Native-Method-Prefix", "Carl-Is-Awesome", "Change", "Copyright", "Created-By", "DSTAMP", "Dependencies", "DynamicImport-Package", "Eclipse-BuddyPolicy", "Eclipse-ExtensibleAPI", "Embed-Dependency", "Embed-Transitive", "Export-Package", "Extension-Name", "Extension-name", "Fragment-Host", "Gradle-Version", "Gremlin-Plugin-Dependencies", "Ignore-Package", "Implementation-Build", "Implementation-Build-Date", "Implementation-Build-Id", "Implementation-Title", "Implementation-URL", "Implementation-Vendor", "Implementation-Vendor-Id", "Implementation-Version", "Import-Package", "Include-Resource", "JCabi-Build", "JCabi-Date", "JCabi-Version", "Main-Class", "Manifest-Version", "Module-Origin", "Module-Requires", "Multi-Release", "Originally-Created-By", "Package", "Premain-Class", "Private-Package", "Provide-Capability", "Require-Bundle", "Require-Capability", "Sealed", "Specification-Title", "Specification-Vendor", "Specification-Version", "TODAY", "TSTAMP", "Target-Label", "Tool", "X-Compile-Elasticsearch-Snapshot", "X-Compile-Elasticsearch-Version", "X-Compile-Lucene-Version", "X-Compile-Source-JDK", "X-Compile-Target-JDK", "artifactId", "groupId", "hash", "janusgraphVersion", "service", "tinkerpop-version", "tinkerpopVersion", "url", "version"]
2023-12-14 16:09:21 16:09:21 INFO org.janusgraph.graphdb.server.JanusGraphServer.printHeader - JanusGraph Version: 1.0.0
2023-12-14 16:09:21 16:09:21 INFO org.janusgraph.graphdb.server.JanusGraphServer.printHeader - TinkerPop Version: 3.7.0
2023-12-14 16:09:21 16:09:21 INFO org.janusgraph.graphdb.server.JanusGraphServer.start - Configuring JanusGraph Server from /etc/opt/janusgraph/janusgraph-server.yaml
2023-12-14 16:09:21 16:09:21 INFO org.apache.tinkerpop.gremlin.server.util.MetricManager.addConsoleReporter - Configured Metrics ConsoleReporter configured with report interval=180000ms
2023-12-14 16:09:21 16:09:21 INFO org.apache.tinkerpop.gremlin.server.util.MetricManager.addCsvReporter - Configured Metrics CsvReporter configured with report interval=180000ms to fileName=/tmp/gremlin-server-metrics.csv
2023-12-14 16:09:21 16:09:21 INFO org.apache.tinkerpop.gremlin.server.util.MetricManager.addJmxReporter - Configured Metrics JmxReporter configured with domain= and agentId=
2023-12-14 16:09:21 16:09:21 INFO org.apache.tinkerpop.gremlin.server.util.MetricManager.addSlf4jReporter - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
2023-12-14 16:09:21 16:09:21 INFO org.apache.commons.beanutils.FluentPropertyBeanIntrospector.introspect - Error when creating PropertyDescriptor for public final void org.apache.commons.configuration2.AbstractConfiguration.setProperty(java.lang.String,java.lang.Object)! Ignoring this property.
2023-12-14 16:09:22 16:09:22 ERROR org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init> - Could not invoke constructor on class org.janusgraph.graphdb.management.JanusGraphManager (defined by the 'graphManager' setting) with one argument of class Settings
2023-12-14 16:09:22 16:09:22 ERROR org.janusgraph.graphdb.server.JanusGraphServer.lambda$main$0 - JanusGraph Server was unable to start and will now begin shutdown
2023-12-14 16:09:22 java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
2023-12-14 16:09:22 at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:97) ~[gremlin-server-3.7.0.jar:3.7.0]
2023-12-14 16:09:22 at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:127) ~[gremlin-server-3.7.0.jar:3.7.0]
2023-12-14 16:09:22 at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:90) ~[gremlin-server-3.7.0.jar:3.7.0]
2023-12-14 16:09:22 at org.janusgraph.graphdb.server.JanusGraphServer.start(JanusGraphServer.java:85) ~[janusgraph-server-1.0.0.jar:?]
2023-12-14 16:09:22 at org.janusgraph.graphdb.server.JanusGraphServer.main(JanusGraphServer.java:53) [janusgraph-server-1.0.0.jar:?]
2023-12-14 16:09:22 Caused by: java.lang.reflect.InvocationTargetException
2023-12-14 16:09:22 at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
2023-12-14 16:09:22 at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
2023-12-14 16:09:22 at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
2023-12-14 16:09:22 at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:?]
2023-12-14 16:09:22 at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:86) ~[gremlin-server-3.7.0.jar:3.7.0]
2023-12-14 16:09:22 ... 4 more
2023-12-14 16:09:22 Caused by: org.janusgraph.core.JanusGraphException: allow-custom-vid-types is not supported for OrderedKeyValueStore
2023-12-14 16:09:22 at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:513) ~[janusgraph-core-1.0.0.jar:?]
2023-12-14 16:09:22 at org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder.build(GraphDatabaseConfigurationBuilder.java:64) ~[janusgraph-core-1.0.0.jar:?]
2023-12-14 16:09:22 at org.janusgraph.core.JanusGraphFactory.lambda$open$0(JanusGraphFactory.java:165) ~[janusgraph-core-1.0.0.jar:?]
2023-12-14 16:09:22 at org.janusgraph.graphdb.management.JanusGraphManager.openGraph(JanusGraphManager.java:239) ~[janusgraph-core-1.0.0.jar:?]
2023-12-14 16:09:22 at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:165) ~[janusgraph-core-1.0.0.jar:?]
2023-12-14 16:09:22 at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:115) ~[janusgraph-core-1.0.0.jar:?]
2023-12-14 16:09:22 at org.janusgraph.graphdb.management.JanusGraphManager.lambda$new$0(JanusGraphManager.java:73) ~[janusgraph-core-1.0.0.jar:?]
2023-12-14 16:09:22 at java.util.LinkedHashMap.forEach(Unknown Source) ~[?:?]
2023-12-14 16:09:22 at org.janusgraph.graphdb.management.JanusGraphManager.<init>(JanusGraphManager.java:72) ~[janusgraph-core-1.0.0.jar:?]
2023-12-14 16:09:22 at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
2023-12-14 16:09:22 at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
2023-12-14 16:09:22 at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
2023-12-14 16:09:22 at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:?]
2023-12-14 16:09:22 at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:86) ~[gremlin-server-3.7.0.jar:3.7.0]
2023-12-14 16:09:22 ... 4 more
2023-12-14 16:09:22 16:09:22 INFO org.apache.tinkerpop.gremlin.server.op.OpLoader.lambda$static$0 - Adding the standard OpProcessor.
2023-12-14 16:09:22 16:09:22 INFO org.apache.tinkerpop.gremlin.server.op.OpLoader.lambda$static$0 - Adding the session OpProcessor.
2023-12-14 16:09:22 16:09:22 INFO org.apache.tinkerpop.gremlin.server.op.OpLoader.lambda$static$0 - Adding the traversal OpProcessor.
2023-12-14 16:09:22 16:09:22 INFO org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$stop$2 - Shutting down OpProcessor[]
2023-12-14 16:09:22 16:09:22 INFO org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$stop$2 - Shutting down OpProcessor[session]
2023-12-14 16:09:22 16:09:22 INFO org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$stop$2 - Shutting down OpProcessor[traversal]
2023-12-14 16:09:22 16:09:22 INFO org.apache.tinkerpop.gremlin.server.GremlinServer.stop - Shutting down thread pools.
2023-12-14 16:09:24 12/14/23, 4:09:24 PM ===========================================================
2023-12-14 16:09:24
2023-12-14 16:09:24 -- Gauges ----------------------------------------------------------------------
2023-12-14 16:09:24 org.apache.tinkerpop.gremlin.server.GremlinServer.sessions
2023-12-14 16:09:24 value = 0
2023-12-14 16:09:24
2023-12-14 16:09:24 -- Timers ----------------------------------------------------------------------
2023-12-14 16:09:24 org.apache.tinkerpop.gremlin.server.GremlinServer.op.eval
2023-12-14 16:09:24 count = 0
2023-12-14 16:09:24 mean rate = 0.00 calls/second
2023-12-14 16:09:24 1-minute rate = 0.00 calls/second
2023-12-14 16:09:24 5-minute rate = 0.00 calls/second
2023-12-14 16:09:24 15-minute rate = 0.00 calls/second
2023-12-14 16:09:24 min = 0.00 milliseconds
2023-12-14 16:09:24 max = 0.00 milliseconds
2023-12-14 16:09:24 mean = 0.00 milliseconds
2023-12-14 16:09:24 stddev = 0.00 milliseconds
2023-12-14 16:09:24 median = 0.00 milliseconds
2023-12-14 16:09:24 75% <= 0.00 milliseconds
2023-12-14 16:09:24 95% <= 0.00 milliseconds
2023-12-14 16:09:24 98% <= 0.00 milliseconds
2023-12-14 16:09:24 99% <= 0.00 milliseconds
2023-12-14 16:09:24 99.9% <= 0.00 milliseconds
2023-12-14 16:09:24 org.apache.tinkerpop.gremlin.server.GremlinServer.op.traversal
2023-12-14 16:09:24 count = 0
2023-12-14 16:09:24 mean rate = 0.00 calls/second
2023-12-14 16:09:24 1-minute rate = 0.00 calls/second
2023-12-14 16:09:24 5-minute rate = 0.00 calls/second
2023-12-14 16:09:24 15-minute rate = 0.00 calls/second
2023-12-14 16:09:24 min = 0.00 milliseconds
2023-12-14 16:09:24 max = 0.00 milliseconds
2023-12-14 16:09:24 mean = 0.00 milliseconds
2023-12-14 16:09:24 stddev = 0.00 milliseconds
2023-12-14 16:09:24 median = 0.00 milliseconds
2023-12-14 16:09:24 75% <= 0.00 milliseconds
2023-12-14 16:09:24 95% <= 0.00 milliseconds
2023-12-14 16:09:24 98% <= 0.00 milliseconds
2023-12-14 16:09:24 99% <= 0.00 milliseconds
2023-12-14 16:09:24 99.9% <= 0.00 milliseconds
2023-12-14 16:09:24
2023-12-14 16:09:24
2023-12-14 16:09:24 16:09:24 INFO com.codahale.metrics.Slf4jReporter$InfoLoggerProxy.log - type=GAUGE, name=org.apache.tinkerpop.gremlin.server.GremlinServer.sessions, value=0
2023-12-14 16:09:24 16:09:24 INFO com.codahale.metrics.Slf4jReporter$InfoLoggerProxy.log - type=TIMER, name=org.apache.tinkerpop.gremlin.server.GremlinServer.op.eval, count=0, min=0.0, max=0.0, mean=0.0, stddev=0.0, p50=0.0, p75=0.0, p95=0.0, p98=0.0, p99=0.0, p999=0.0, m1_rate=0.0, m5_rate=0.0, m15_rate=0.0, mean_rate=0.0, rate_unit=events/second, duration_unit=milliseconds
2023-12-14 16:09:24 16:09:24 INFO com.codahale.metrics.Slf4jReporter$InfoLoggerProxy.log - type=TIMER, name=org.apache.tinkerpop.gremlin.server.GremlinServer.op.traversal, count=0, min=0.0, max=0.0, mean=0.0, stddev=0.0, p50=0.0, p75=0.0, p95=0.0, p98=0.0, p99=0.0, p999=0.0, m1_rate=0.0, m5_rate=0.0, m15_rate=0.0, mean_rate=0.0, rate_unit=events/second, duration_unit=milliseconds
2023-12-14 16:09:24 16:09:24 INFO org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$stop$9 - Gremlin Server - shutdown complete
您可以看到日志显示
waiting for storage...
步骤的初始长时间延迟,只有当我将 allow-custom-vid-types=true
传递到容器时才会发生。
version: '3.7'
services:
graph:
image: janusgraph/janusgraph
environment:
janusgraph.graph.set-vertex-id: true
janusgraph.graph.allow-custom-vid-types: true
ports:
- "8182:8182"
正如错误消息所示
allow-custom-vid-types is not supported for OrderedKeyValueStore
。
对于 JanusGraph 1.0.0
BerkeleyJEKeyValueStore
实现了 OrderedKeyValueStore
这意味着自定义顶点 id 类型不能与 Berkeley DB
数据库一起使用。
JanusGraph docker 镜像 (1.0.0) 默认使用 Berkeley DB
存储选项(如 JanusGraph Docker 概述中所述)。
在您的情况下,您需要指定与 JanusGraph 一起使用的另一个存储后端,而不是使用默认的基于文件的存储选项。但是,它将要求您设置存储后端(即,以便它在配置的存储主机和端口上可用)。 您可以选择 Cassandra、HBase、ScyllaDB、Bigtable 或任何提供的存储适配器来使用
allow-custom-vid-types
选项。
要修复您的示例,您可以使用类似的 docker 文件,如 JanusGraph + Cassandra + ElasticSearch docker 撰写文件(here)中所示。但是,由于您不需要 ElasticSearch,因此可以使用
JANUS_PROPS_TEMPLATE: cql
而不是 JANUS_PROPS_TEMPLATE: cql-es
。
使用 Cassandra + JanusGraph 和激活的自定义顶点 ID 类型的完整 docker-compose 文件可能如下所示:
version: "3"
services:
janusgraph:
image: docker.io/janusgraph/janusgraph:latest
container_name: jce-janusgraph
environment:
JANUS_PROPS_TEMPLATE: cql
janusgraph.storage.hostname: jce-cassandra
janusgraph.graph.allow-custom-vid-types: "true"
janusgraph.graph.set-vertex-id: "true"
ports:
- "8182:8182"
networks:
- jce-network
healthcheck:
test: ["CMD", "bin/gremlin.sh", "-e", "scripts/remote-connect.groovy"]
interval: 10s
timeout: 30s
retries: 3
depends_on:
cassandra:
condition: service_started
cassandra:
image: cassandra:3
container_name: jce-cassandra
ports:
- "9042:9042"
- "9160:9160"
networks:
- jce-network
networks:
jce-network:
volumes:
janusgraph-default-data:
在文档中查看有关 JanusGraph Docker 容器(配置、用法等)的更多信息:https://docs.janusgraph.org/operations/container/