2

我已经在我的 Mac (OS X 10.11.6) 上安装并运行 Cassandra 3.11.1。在终端中运行cqlsh会打印以下消息:

Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh> 

所以 Cassandra 应该可以正常工作。使用 Java API,我尝试Graph使用以下几行创建连接到 Cassandra 存储后端:

JanusGraph graph = JanusGraphFactory.build()
    .set("storage.backend", "cassandra")
    .set("storage.hostname", "127.0.0.1")
    .open();

但是,这将导致以下异常:

java.lang.IllegalArgumentException: Could not instantiate implementation: org.janusgraph.diskstorage.cassandra.astyanax.AstyanaxStoreManager
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:69)
    at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:477)
    at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:409)
    at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1353)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:107)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:97)
    at org.janusgraph.core.JanusGraphFactory$Builder.open(JanusGraphFactory.java:152)
    at engineering.divine.core.GraphFactory.cassandraGraph(GraphFactory.java:395)
    at engineering.divine.core.GraphFactory.graph(GraphFactory.java:301)
    at engineering.divine.core.GraphFactory.getDefault(GraphFactory.java:102)
    at engineering.divine.repository.Repository.listRepositoriesToUpdate(Repository.java:130)
    at engineering.divine.daemon.RepositoryAnalysisDaemon.run(RepositoryAnalysisDaemon.java:24)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:58)
    ... 18 more
Caused by: org.janusgraph.diskstorage.TemporaryBackendException: Temporary failure in storage backend
    at org.janusgraph.diskstorage.cassandra.astyanax.AstyanaxStoreManager.ensureKeyspaceExists(AstyanaxStoreManager.java:590)
    at org.janusgraph.diskstorage.cassandra.astyanax.AstyanaxStoreManager.<init>(AstyanaxStoreManager.java:302)
    ... 23 more
Caused by: com.netflix.astyanax.connectionpool.exceptions.PoolTimeoutException: PoolTimeoutException: [host=127.0.0.1(127.0.0.1):9160, latency=10003(10003), attempts=1]Timed out waiting for connection
    at com.netflix.astyanax.connectionpool.impl.SimpleHostConnectionPool.waitForConnection(SimpleHostConnectionPool.java:231)
    at com.netflix.astyanax.connectionpool.impl.SimpleHostConnectionPool.borrowConnection(SimpleHostConnectionPool.java:198)
    at com.netflix.astyanax.connectionpool.impl.RoundRobinExecuteWithFailover.borrowConnection(RoundRobinExecuteWithFailover.java:84)
    at com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl.tryOperation(AbstractExecuteWithFailoverImpl.java:117)
    at com.netflix.astyanax.connectionpool.impl.AbstractHostPartitionConnectionPool.executeWithFailover(AbstractHostPartitionConnectionPool.java:352)
    at com.netflix.astyanax.thrift.ThriftClusterImpl.executeSchemaChangeOperation(ThriftClusterImpl.java:146)
    at com.netflix.astyanax.thrift.ThriftClusterImpl.internalCreateKeyspace(ThriftClusterImpl.java:321)
    at com.netflix.astyanax.thrift.ThriftClusterImpl.addKeyspace(ThriftClusterImpl.java:294)
    at org.janusgraph.diskstorage.cassandra.astyanax.AstyanaxStoreManager.ensureKeyspaceExists(AstyanaxStoreManager.java:585)
    ... 24 more

我也已经尝试过ports 127.0.0.1:9160127.0.0.1:9042和. 我在这里想念什么?127.0.0.1:7000127.0.0.1:7199

4

1 回答 1

4

和后端使用 Thrift cassandracassandrathrift在 Cassandra 3.11.1 中默认未启用。您可以在cassandra.yamlby 设置start_rpc: true或命令行中启用 Thrift nodetool enablethrift

如果您使用的是 JanusGraph 0.2.0 或更高版本,则可以使用使用原生 CQL 协议的 CQL 存储适配器。您可以通过设置为 来做到这storage.backend一点cql在 JanusGraph配置参考中阅读有关 CQL 选项的更多信息。

于 2017-11-18T20:39:47.830 回答