连接上的Titan后端异常

时间:2015-07-20 09:49:55

标签: cassandra graph-databases titan

我正在使用Titan 0.54和Cassandra 2.1.6。

我编写了一个Java程序,能够连接到Titan并在我的本地Cassandra集群上运行工作负载。当我尝试在另一台机器上运行相同的软件(有自己的集群)时,我得到以下错误(将storage.backend设置为“cassandrathrift”):

Exception in thread "main" com.thinkaurelius.titan.core.TitanException: Could not execute operation due to backend exception
    at com.thinkaurelius.titan.diskstorage.util.BackendOperation.execute(BackendOperation.java:44)
    at com.thinkaurelius.titan.diskstorage.util.BackendOperation.execute(BackendOperation.java:144)
    at com.thinkaurelius.titan.diskstorage.configuration.backend.KCVSConfiguration.get(KCVSConfiguration.java:92)
    at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.isFrozen(BasicConfiguration.java:93)
    at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1289)
    at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:93)
    at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:134)
    at com.x.tweetgraph.writer.graph.TitanConnector.getConnection(TitanConnector.java:17)
    at com.x.tweetgraph.writer.graph.GraphManager.loadGraph(GraphManager.java:186)
    at com.x.tweetgraph.writer.graph.GraphManager.init(GraphManager.java:99)
    at com.x.tweetgraph.writer.graph.Main.main(Main.java:26)
Caused by: com.thinkaurelius.titan.diskstorage.PermanentBackendException: Permanent failure in storage backend
    at com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.convertException(CassandraThriftKeyColumnValueStore.java:249)
    at com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getNamesSlice(CassandraThriftKeyColumnValueStore.java:148)
    at com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getNamesSlice(CassandraThriftKeyColumnValueStore.java:91)
    at com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getSlice(CassandraThriftKeyColumnValueStore.java:80)
    at com.thinkaurelius.titan.diskstorage.configuration.backend.KCVSConfiguration$1.call(KCVSConfiguration.java:95)
    at com.thinkaurelius.titan.diskstorage.configuration.backend.KCVSConfiguration$1.call(KCVSConfiguration.java:92)
    at com.thinkaurelius.titan.diskstorage.util.BackendOperation.execute(BackendOperation.java:133)
    at com.thinkaurelius.titan.diskstorage.util.BackendOperation$1.call(BackendOperation.java:147)
    at com.thinkaurelius.titan.diskstorage.util.BackendOperation.executeDirect(BackendOperation.java:56)
    at com.thinkaurelius.titan.diskstorage.util.BackendOperation.execute(BackendOperation.java:42)
    ... 10 more
Caused by: TimedOutException()
    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 com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getNamesSlice(CassandraThriftKeyColumnValueStore.java:129)
    ... 18 more

将storage.backend设置为“cassandra”后,我得到以下内容:

Caused by: TimedOutException()
    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 com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$4$1.internalExecute(ThriftColumnFamilyQueryImpl.java:533)
    at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$4$1.internalExecute(ThriftColumnFamilyQueryImpl.java:530)
    at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:60)
    ... 24 more

这两个选项都适用于我的本地设置(单节点Cassandra集群)。来自cassandra.yaml:

listen_address: 136.225.5.31
start_native_transport: true
native_transport_port: 12742
start_rpc: true
rpc_address: 136.225.5.31
rpc_port: 12760

我尝试连接的设置是一个三节点集群:

listen_interface: eth1
start_native_transport: true
native_transport_port: 12742
start_rpc: true
rpc_interface: eth1
rpc_port: 12760

在第一次设置时,我使用rpc_address + rpc_port获得Titan连接,但是当我在第二次设置时尝试时,我得到上面的错误。

我是否需要使用与storage.hostname的节点IP不同的设置来考虑在第二次设置中指定rpc_interface而不是rpc_address?或者问题是什么?

我可以使用cqlsh(以及我编写的其他软件)连接到第二个集群,因此这不是集群的问题。

1 个答案:

答案 0 :(得分:0)

我设法解决了这个问题。

我忽略了在TitanFactory.build()中设置storage.cassandra.replication-factor属性,因此Titan使用默认复制因子1,它在我的单节点测试集群上运行。显然,三个节点之一存在一些问题,因此我在每个节点上运行nodetool修复并将storage.cassandra.replication-factor设置为3.这解决了问题。