If you are using Spark 1. +, try setting the optional Path Path property in your Spark configuration
Add this line to spark-defaults.conf -
spark.executor.extraClassPath / opt / cloudera / parcels / CDH / lib / hive / lib / hive -hbase-handler.jar: /opt/cloudera/parcels/CDH/lib/hbase/hbase-server.jar: / opt / cloudera / parcels / CDH / lib / hbase / hbase-protocol.jar: /opt/cloudera/parcels/CDH/lib/hbase/hbase-hadoop2-compat.jar: / opt / cloudera / parcels / CDH / lib / hbase / hbase-client.jar: /opt/cloudera/parcels/CDH/lib/hbase/hbase-common.jar: /opt/cloudera/parcels/CDH/lib/hbase/lib/htrace-core.jar
If you are using a different distribution, find the appropriate path for the jar files.
In addition to changing the configuration, add the driver class path to the spark shell or when sending your spark work as -
- driver-class-way
/opt/cloudera/parcels/CDH/lib/hbase/hbase-server.jar:/opt/cloudera/parcels/CDH/lib/hbase/hbase-protocol.jar:/opt/cloudera/parcels/CDH/lib/hbase /hbase-hadoop2-compat.jar:/opt/cloudera/parcels/CDH/lib/hbase/hbase-client.jar:/opt/cloudera/parcels/CDH/lib/hbase/hbase-common.jar:/opt/ Cloudera / Parcels / CDH / Library / HBase / Library / htrace-core.jar
You can add jar files to the classβs spark path in spark-env.sh to avoid specifying the full path every time you want to launch the spark shell or submit the spark job, but I run into other problems when using this approach, I found the options above to work better for me.
export SPARK_CLASSPATH = / opt / Cloudera / parcel / CDH / Library / HBase / HBase-server.jar: /opt/cloudera/parcels/CDH/lib/hbase/hbase-protocol.jar: / opt / Cloudera / parcel / CDH / Library / hbase / hbase-hadoop2-compat.jar: /opt/cloudera/parcels/CDH/lib/hbase/hbase-client.jar: /opt/cloudera/parcels/CDH/lib/hbase/hbase-common.jar: / select/Cloudera/packages/CDH/Library/HBase/Library/htrace-core.jar
Nothing more needed for Spark 1. +
If you are using Spark 0.9, see this link - yes, the links may break, but I have not tested Spark 0.9, and this blog contains useful information http://www.abcn.net/2014/07/lighting-spark-with- hbase-full-edition.html
source share