2016-07-22 7 views
3

SparkGraphComputer를 사용하여 클러스터의 Titan 그래프에서 정점 수를 계산할 때 오류가 발생합니다. 나는 어떻게 대처해야할지 모른다. 내 코드에서 tinkerpop 3.1.1-incubating 및 Titan 1.1.0-SNAPSHOT을 사용 중이며 클러스터에서 datastax 커뮤니티 에디션 2.1.11을 설치하고 1.5.2-bin-hadoop2.6을 실행했습니다.SparkGraphComputer를 사용하여 타이탄 그래프에서 꼭짓점을 계산하면 org.apache.spark.SparkException이 발생합니다. 스테이지 실패로 인해 작업이 중단되었습니다.

FulgoraGraphComputer와 OLAP를 OLTP를 사용하여

private void strippedDown() { 
    // a normal titan cluster 
    String titanClusterConfig = "titan-cassandra-test-cluster.properties"; 

    // a hadoop graph with cassandra as input and gryo as output 
    String sparkClusterConfig = "titan-cassandra-test-spark.properties"; 

    String edgeLabel = "blank"; 

    // add a graph 
    int n = 100; 
    Graph titanGraph = GraphFactory.open(titanClusterConfig); 
    Vertex superNode = titanGraph.addVertex(T.label, String.valueOf(0)); 
    for (int i=1;i<n;i++) { 
     Vertex currentNode = titanGraph.addVertex(T.label, String.valueOf(i)); 
     currentNode.addEdge(edgeLabel,superNode); 
    } 
    titanGraph.tx().commit(); 

    //count with titan 
    Long count = titanGraph.traversal().V().count().next(); 
    System.out.println("The number of vertices in the graph is: "+count); 

    // count the graph using titan graph computer 
    count = titanGraph.traversal(GraphTraversalSource.computer(FulgoraGraphComputer.class)).V().count().next(); 
    System.out.println("The number of vertices in the graph is: "+count); 

    // count the graph using spark graph computer 
    Graph sparkGraph = GraphFactory.open(sparkClusterConfig); 
    count = sparkGraph.traversal(GraphTraversalSource.computer(SparkGraphComputer.class)).V().count().next(); 
    System.out.println("The number of vertices in the graph is: "+count); 
} 

카운트는 정답을 반환 : 함께 최소한의 자바 예를 들어 내 문제를 재현한다. 그러나 SparkGraphComputer를 사용하는 OLAP 카운트는 org.apache.spark.SparkException을 throw합니다. 스테이지 실패로 인해 작업이 중단되었습니다.

재미있는 점은 Titan과 함께 패키지 된 gremlin 콘솔을 통해 유사한 스크립트를 실행하면 다른 오류가 발생합니다. 같은 알고리즘 :

graph = GraphFactory.open('titan-cassandra-test-cluster.properties') 
graph.addVertex(T.label,"0") 
graph.addVertex(T.label,"1") 
graph.addVertex(T.label,"2") 
graph.tx().commit() 
sparkGraph = GraphFactory.open('titan-cassandra-test-spark.properties') 
sparkGraph.traversal(computer(SparkGraphComputer)).V().count() 

이 코드는 org.apache.thrift.protocol.TProtocolException: Required field 'keyspace' was not present! Struct: set_keyspace_args(keyspace:null)을 두 번 던지지만 완료하고 0을 반환합니다.

메일 링리스트에 this article을 알고 있지만 문제를 이해하거나 문제를 해결하는 데 어려움이 있습니다. 아무도 나에게 무슨 일이 일어나고 있고 어떻게 해결할 수 있는지 설명해 주시겠습니까? 아래에 내 구성을 붙여 넣었습니다.

gremlin.graph=com.thinkaurelius.titan.core.TitanFactory 
storage.backend=cassandrathrift 
storage.hostname=node1 
storage.cassandra.keyspace=mindmapstest 
storage.cassandra.replication-factor=3 
cache.db-cache = true 
cache.db-cache-clean-wait = 20 
cache.db-cache-time = 180000 
cache.db-cache-size = 0.5 

gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph 
gremlin.hadoop.graphInputFormat=com.thinkaurelius.titan.hadoop.formats.cassandra.CassandraInputFormat 
gremlin.hadoop.graphOutputFormat=org.apache.hadoop.mapreduce.lib.output.NullOutputFormat 
gremlin.hadoop.jarsInDistributedCache=true 
gremlin.hadoop.inputLocation=none 
gremlin.hadoop.outputLocation=none 
#################################### 
# Cassandra Cluster Config   # 
#################################### 
titanmr.ioformat.conf.storage.backend=cassandrathrift 
titanmr.ioformat.conf.storage.cassandra.keyspace=mindmapstest 
titanmr.ioformat.conf.storage.hostname=node1,node2,node3 
#################################### 
# SparkGraphComputer Configuration # 
#################################### 
spark.master=spark://node1:7077 
spark.executor.memory=250m 
spark.serializer=org.apache.spark.serializer.KryoSerializer 
#################################### 
# Apache Cassandra InputFormat configuration 
#################################### 
cassandra.input.partitioner.class=org.apache.cassandra.dht.Murmur3Partitioner 

편집 :이 스크립트 오류를 ​​parameters 당신의 HadoopGraph 구성에 이러한 추가

graph = TitanFactory.open('titan-cassandra-test-cluster.properties') 
superNode = graph.addVertex(T.label,"0") 
for(i in 1..100) { 
    currentNode = graph.addVertex(T.label,i.toString()) 
    currentNode.addEdge("blank",superNode) 
} 
graph.tx().commit() 

graph.traversal().V().count() 

graph.traversal(computer()).V().count() 

sparkGraph = GraphFactory.open('titan-cassandra-test-spark.properties') 
sparkGraph.traversal(computer(SparkGraphComputer)).V().count() 

답변

1

내가 제공 할 이유가 100 % 확실하지는 않지만 문제를 해결할 수있었습니다. 내 문제는 3 가지 근본적인 문제에서 비롯되었으며, 모두 구성과 관련됩니다.

1) 첫 번째 문제는 친절 제이슨에 의해 해결되었다 이것은 카산드라에 연결하기위한 올바른 구성 옵션을 가지고 관련이 있었다 - 나는 아직도 그들도 무슨 궁금합니다.

2) Java 코드를 성공적으로 실행할 수없는 이유는 HADOOP_GREMLIN_LIBS 환경 변수를 올바르게 설정하지 않았기 때문입니다. 이러한 이유로 병 컴퓨터는 그래프 컴퓨터에서 사용하기 위해 클러스터에 배치되지 않았습니다. 일단 이것이 설정되면 gremlin 콘솔과 자바 예제는 동일한 문제를 가지며 0의 카운트를 반환합니다.

3) 제로의 카운트는 해결하기 어려운이었다. 다시 설명서를 이해하지 못한 경우. hadoop을 내 클러스터에 설치하는 것에 대한 언급이 많았지 만, 클러스터에 hadoop을 연결하는 방법에 대해서는 언급하지 않았습니다. 이 추가 구성 옵션을하기 위해 클러스터에 하둡 파일 시스템을 찾을 수 놈아을 알려줍니다 fs.defaultFS을 요구했다. 이것이 올바르게 설정되면 꼭짓점 수는 정확합니다.

필자의 이론은 계산이 올바르게 실행되었다는 것이지만, spark 작업자의 카운트를 줄이려고했을 때 클러스터의 어느 곳에서나 유지되었다가 콘솔에 응답을 반환 할 때 로컬 파일 시스템을 보았지만 따라서 0을 반환합니다. 이것은 아마도 버그입니까?

어쨌든 내가 필요한 최종 구성 파일은 다음과 같습니다

gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph 
gremlin.hadoop.graphInputFormat=com.thinkaurelius.titan.hadoop.formats.cassandra.CassandraInputFormat 
gremlin.hadoop.graphOutputFormat=org.apache.hadoop.mapreduce.lib.output.NullOutputFormat 
gremlin.hadoop.jarsInDistributedCache=true 
gremlin.hadoop.inputLocation=none 
gremlin.hadoop.outputLocation=/test/output 
#################################### 
# Cassandra Cluster Config   # 
#################################### 
titanmr.ioformat.conf.storage.backend=cassandrathrift 
titanmr.ioformat.conf.storage.cassandra.keyspace=mindmapstest 
titanmr.ioformat.conf.storage.hostname=node1,node2,node3 
titanmr.ioformat.cf-name=edgestore 
#################################### 
# SparkGraphComputer Configuration # 
#################################### 
spark.master=spark://node1:7077 
spark.executor.memory=1g 
spark.serializer=org.apache.spark.serializer.KryoSerializer 
#################################### 
# Apache Cassandra InputFormat configuration 
#################################### 
cassandra.input.partitioner.class=org.apache.cassandra.dht.Murmur3Partitioner 
cassandra.input.keyspace=mindmapstest 
cassandra.input.predicate=0c00020b0001000000000b000200000000020003000800047fffffff0000 
cassandra.input.columnfamily=edgestore 
cassandra.range.batch.size=2147483647 
spark.eventLog.enabled=true 
#################################### 
# Hadoop Cluster configuration  # 
#################################### 
fs.defaultFS=hdfs://node1:9000 
+0

일반적으로 속성 파일에'fs.defaultFS'가 없습니다. 대신'gremlin.sh'를 시작하기 전에 classpath에 $ HADOOP_CONF_DIR을 포함시킵니다. 그런 다음 HDFS에 액세스 할 수 있는지 확인하기위한 또 다른 예방책으로, 콘솔을 시작한 후 'hdfs.ls()'를 실행하여 로컬 파일 시스템이 아닌 HDFS의 파일을 나열하는지 확인합니다. –

+0

'cassandra.input. *'속성에 관해서는 올바른 설정 속성이 전달되는 것처럼 보이지 않으므로 타이탄에 버그가있을 가능성이 있습니다. 2 개의 소스 코드 파일 ('ConfigHelper.java'와'CassandraBinaryInputFormat.java')을 참조하여 그들이하는 일을 볼 수 있습니다. 특히, '술어'는 전 범위 스 드리프트 슬라이스 쿼리 술어의 직렬화 된 버전입니다. –

3

시도를 재현합니다.

# 
# Titan Cassandra InputFormat configuration 
# see https://github.com/thinkaurelius/titan/blob/titan11/titan-hadoop-parent/titan-hadoop-core/src/main/java/com/thinkaurelius/titan/hadoop/formats/cassandra/CassandraBinaryInputFormat.java 
titanmr.ioformat.conf.storage.backend=cassandrathrift 
titanmr.ioformat.conf.storage.hostname=node1,node2,node3 
titanmr.ioformat.conf.storage.cassandra.keyspace=titan 
titanmr.ioformat.cf-name=edgestore 

# 
# Apache Cassandra InputFormat configuration 
# see https://github.com/apache/cassandra/blob/cassandra-2.2.3/src/java/org/apache/cassandra/hadoop/ConfigHelper.java 
# see https://github.com/thinkaurelius/titan/blob/titan11/titan-hadoop-parent/titan-hadoop-core/src/main/java/com/thinkaurelius/titan/hadoop/formats/cassandra/CassandraBinaryInputFormat.java 
# not clear why these need to be set manually when using cassandrathrift 
cassandra.input.partitioner.class=org.apache.cassandra.dht.Murmur3Partitioner 
cassandra.input.keyspace=titan 
cassandra.input.predicate=0c00020b0001000000000b000200000000020003000800047fffffff0000 
cassandra.input.columnfamily=edgestore 
cassandra.range.batch.size=2147483647 
+0

이 모두 지금 노력이 제이슨 주셔서 감사합니다. 저 configs가하고있는 것을 통해 저를 실행할 수 있습니까? 술어에 대한 특히 긴 해쉬 ... – Sheldon

+0

OK 그것이 실제로 작동하지 않는 것처럼 보입니다. 위의 EDIT 스크립트를 gremlin 쉘에 제출하면 완료하는 데 오랜 시간이 걸리고 항상 0을 반환합니다. – Sheldon

+0

'titanmr.ioformat.conf와 일치하는'cassandra.input.keyspace' 값을 추가했는지 확인 했습니까? .storage.cassandra.keyspace'? –