这是我的问题:
我们使用 cloudera 5.7.0 和 java 1.8.0_74,我们有 spark 1.6.0、janusgraph 0.1.1、hbase 1.2.0。
我在 gremlin shell 中运行以下代码:
:load data/call-janusgraph-schema-groovy
writeGraphPath='conf/my-janusgraph-hbase.properties'
writeGraph=JanusGraphFactory.open(writeGraphPath)
defineCallSchema(writeGraph)
writeGraph.close()
readGraph=GraphFactory.open('conf/hadoop-graph/hadoop-call-script.properties')
gRead=readGraph.traversal()
gRead.V().valueMap()
//so far so good everything works perfectly
blvp=BulkLoaderVertexProgram.build().keepOriginalIds(true).writeGraph(writeGraphPath).create(readGraph)
readGraph.compute(SparkGraphComputer).workers(1).program(blvp).submit().get()
它开始执行 spark 作业,第一阶段运行顺利,但是在第二阶段我得到一个异常:
java.lang.NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch;
at org.janusgraph.graphdb.database.idassigner.StandarIdPool.waitForIDBlockGetter(StandartIDPool.java:136).......
我认为这是一个番石榴版本问题
这是我启动 gremlin shell 的方法
#!/bin/bash
export JAVA_HOME=/mnt/hdfs/jdk.1.8.0_74
export HADOOP_HOME=/opt/cloudera/parcels/CDH-5.7.0-1.cdh5.7.0.p0.45/lib/hadoop
export HADOOP_CONF_DIR= /etc/hadoop/conf.cloudera.yarn
export YARN_HOME=/opt/cloudera/parcels/CDH-5.7.0-1.cdh5.7.0.p0.45/lib/hadoop-yarn
export YARN_CONF_DIR=$HADOOP_CONF_DIR
export SPARK_HOME=/opt/cloudera/parcels/CDH-5.7.0-1.cdh5.7.0.p0.45/lib/spark
export SPARK_CONF_DIR=$SPARK_HOME/conf
export HBASE_HOME=/opt/cloudera/parcels/CDH-5.7.0-1.cdh5.7.0.p0.45/lib/hbase
export HBASE_CONF_DIR=$HBASE_HOME/conf
source "$HADOOP_CONF_DIR"/hadoop-env.sh
source "$SPARK_HOME"/bin/load-spark-env.sh
source "$HBASE_CONF_DIR"/hbase-env.sh
export JAVA_OPTIONS="$JAVA_OPTIONS -Djava.library.path=/opt/cloudera/parcels/CDH-5.7.0-1.cdh5.7.0.p0.45/lib/hadoop/lib/native -Dtinkerpop.ext=ext -Dlog4j.configuration=conf/log4j-console.properties -Dgremlin.log4j.level=$GREMLIN_LOG_LEVEL -javaagent:/mnt/hdfs/janusgraph-0.1.1-hadoop2/lib/jamm-0.3.0.jar -Dhdp.version=$HDP_VERSION"
GREMLINHOME=/mnt/hdfs/janusgraph-0.1.1-hadoop2
export HADOOP_GREMLIN_LIBS=$GREMLINHOME/lib
export CLASSPATH=$HADOOP_HOME/etc/hadoop
export CLASSPATH=$CLASSPATH:$HBASE_HOME/conf
export CLASSPATH=$GREMLINHOME/lib/*:$YARN_HOME/*:$YARN_CONF_DIR:$SPARK_HOME/lib/*:$SPARK_CONF_DIR:$CLASSPATH
cd $GREMLINHOME
export GREMLIN_LOG_LEVEL=info
exec $GREMLINHOME/bin/gremlin.sh $*
这是我的 conf/hadoop-graph/hadoop-call-script.properties 文件:
gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
gremlin.hadoop.GraphInputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.script.ScriptInputFormat
gremlin.hadoop.inputLocation=/user/hive/warehouse/tablex/000000_0
gremlin.hadoop.scriptInputFormat.script=/user/me/janus/script-input-call.groovy
gremlin.hadoop.outputLocation=output
gremlin.hadoop.jarsInDistributedCache=true
spark.driver.maxResultSize=8192
spark.yarn.executor.memoryOverhead=5000
spark.executor.cores=1
spark.executor.instances=1000
spark.master=yarn-client
spark.executor.memory=10g
spark.driver.memory=10g
spark.serializer=org.apache.spark.serializer.JavaSerializer
如果我将“spark.master=yarn-client”行更改为“spark.master=local[*]”,那么它会完美运行并将数据加载到 janusgraph,不会引发异常。但是我需要使用纱线,这对我来说是必须的。因此,我将 guava-18.0.jar 添加到 hdfs 并将行“spark.executor.extraClassPath=hdfs:///user/me/guava-18.0.jar”添加到 hadoop-call-script.properties。它没有解决问题。
目前我没有想法和无助,任何帮助表示赞赏。
不是:我知道 mvn 着色与此问题有关,但是在这种情况下,由于我使用 janusgraph 代码创建火花作业,我无法干预和着色番石榴包。
提前谢谢,阿里