gpt4 book ai didi

java - 两面图 : Cassandra thrift timeout exception

转载 作者:行者123 更新时间:2023-12-01 18:09:58 26 4
gpt4 key购买 nike

我正在使用嵌入式格式的 Janusgraph,后端为 cassandrathrift。以下是我的 janusgraph 和 cassandra 的属性:

storage.backend=cassandrathrift
storage.cassandra.keyspace=t_graph
storage.cassandra.frame-size-mb=128
storage.hostname=10.XX.XX.XX,20.XX.XX.XX,30.XX.XX.XX

我有一个查询可以找出特定顶点的追随者计数。这是代码:

public class FollowCountNormal {

private static JanusGraph graph;
private static GraphTraversalSource traversalSource;

public static void main(String[] args) {
create();
System.exit(0);
}

public static JanusGraph create() {

graph = JanusGraphFactory.open("/resources/jp.properties");
traversalSource = graph.traversal();
getAllEdges();
return graph;
}

static long getAllEdges(){

try{
GraphTraversal<Vertex, Vertex> allV = traversalSource.V();
GraphTraversal<Vertex, Vertex> gt = allV.has("vid", "supernode");
GraphTraversal<Vertex, Long> c = gt.inE()
.count();
long l = c.next();
System.out.println("All edges = "+l);
graph.tx().commit();
return l;
}catch (Exception e) {
System.out.println("Error while fetching the edges for : ");
e.printStackTrace();
}

return -1;
}
}

如果顶点的传入边数量有限(即追随者计数小于 100000 时工作正常),则此代码可以正常工作。但如果关注者数量以百万为单位,我会得到以下异常:

Caused by: org.janusgraph.diskstorage.PermanentBackendException: Permanent failure in storage backend at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.convertException(CassandraThriftKeyColumnValueStore.java:263) at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getNamesSlice(CassandraThriftKeyColumnValueStore.java:162) at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getNamesSlice(CassandraThriftKeyColumnValueStore.java:105) at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getSlice(CassandraThriftKeyColumnValueStore.java:94) at org.janusgraph.diskstorage.keycolumnvalue.KCVSProxy.getSlice(KCVSProxy.java:77) at org.janusgraph.diskstorage.keycolumnvalue.cache.ExpirationKCVSCache$2.call(ExpirationKCVSCache.java:100) at org.janusgraph.diskstorage.keycolumnvalue.cache.ExpirationKCVSCache$2.call(ExpirationKCVSCache.java:96) at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) ... 50 common frames omitted Caused by: org.apache.cassandra.thrift.TimedOutException: null at org.apache.cassandra.thrift.Cassandra$multiget_slice_result$multiget_slice_resultStandardScheme.read(Cassandra.java:14696) at org.apache.cassandra.thrift.Cassandra$multiget_slice_result$multiget_slice_resultStandardScheme.read(Cassandra.java:14633) at org.apache.cassandra.thrift.Cassandra$multiget_slice_result.read(Cassandra.java:14559) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) at org.apache.cassandra.thrift.Cassandra$Client.recv_multiget_slice(Cassandra.java:741) at org.apache.cassandra.thrift.Cassandra$Client.multiget_slice(Cassandra.java:725) at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getNamesSlice(CassandraThriftKeyColumnValueStore.java:143) ... 58 common frames omitted

我在网上查找了很多这样的帖子:

link1

但没有解决方案对我有用。关于如何解决这个问题有什么建议吗?

最佳答案

将存储后端更改为 cql 以及与 cql 相关的其他属性解决了我的问题。以下是我使用的属性:

storage.backend=cql
storage.cql.keyspace=t_graph
storage.cql.read-consistency-level=ONE

关于java - 两面图 : Cassandra thrift timeout exception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60484409/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com