本篇内容主要讲解“hive连接hbase外部表时insert数据报错怎么办”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“hive连接hbase外部表时insert数据报错怎么办”吧!
创新互联-专业网站定制、快速模板网站建设、高性价比德惠网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式德惠网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖德惠地区。费用合理售后完善,十载实体公司更值得信赖。
hive连接hbase外部表成功后,可以正常的查询hbase的数据了。但是向hbase插入数据却报错了。
Error: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.apache.hadoop.hbase.client.Put.setDurability(Lorg/apache/hadoop/hbase/client/Durability;)V at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.map(ExecMapper.java:168) at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54) at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:453) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158) Caused by: java.lang.NoSuchMethodError: org.apache.hadoop.hbase.client.Put.setDurability(Lorg/apache/hadoop/hbase/client/Durability;)V at org.apache.hadoop.hive.hbase.HiveHBaseTableOutputFormat$MyRecordWriter.write(HiveHBaseTableOutputFormat.java:142) at org.apache.hadoop.hive.hbase.HiveHBaseTableOutputFormat$MyRecordWriter.write(HiveHBaseTableOutputFormat.java:117) at org.apache.hadoop.hive.ql.io.HivePassThroughRecordWriter.write(HivePassThroughRecordWriter.java:40) at org.apache.hadoop.hive.ql.exec.FileSinkOperator.process(FileSinkOperator.java:743) at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:837) at org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator.java:97) at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:837) at org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOperator.java:115) at org.apache.hadoop.hive.ql.exec.MapOperator$MapOpCtx.forward(MapOperator.java:169) at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:561) at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.map(ExecMapper.java:159) ... 8 more
在网上查找问题,发现MapR解决过这个问题,参考页面http://doc.mapr.com/display/components/Hive+Release+Notes;jsessionid=73C03B3BB0D8547A19E6CCEF80010D30#HiveReleaseNotes-Hive1.2.1-1601ReleaseNotes
的Hive 1.2.1-1601 Release Notes的说明,fe18d11的commit的说明中和我当前错误一致的。但是这个MapR公司对hive版本的一个patch,我用的是apache的版本,改到MapR的hive版本不现实啊,尝试按照他补丁包中的updated,进行更新我自己的hive的jar包和配置,发现又引出新的问题。这种方式不行啊,得换条路了。
查看hive官方的发布版本,当前有两个版本apache-hive-1.2.1-bin.tar.gz和apache-hive-2.0.0-bin.tar.gz 。我当前是1.2.1的,我可以升级到2.0.0试一下。
下载2.0.0版本并安装,主要是修改了hive-site.xml文件(执行cp hive-default.xml.template hive-site.xml)。同时在hive/lib目录下引入hbase的jar包:
guava-14.0.1.jar protobuf-java-2.5.0.jar hbase-client-1.1.1.jar hbase-common-1.1.1.jar zookeeper-3.4.6.jar hbase-server-1.1.1.jar
hive-site.xml
hive.exec.scratchdir /tmp/hive HDFS root scratch dir for Hive jobs which gets created with write all (733) permission. For each connecting user, an HDFS scratch dir: ${hive.exec.scratchdir}/<username> is created, with ${hive.scratch.dir.permission}. hive.exec.local.scratchdir /data/hive/logs Local scratch space for Hive jobs ... hive.downloaded.resources.dir /tmp/hive/temp0_resources Temporary local directory for added resources in the remote file system. javax.jdo.option.ConnectionPassword password password to use against metastore database javax.jdo.option.ConnectionURL jdbc:MySQL://localhost:3306/hive_db?createDatabaseIfNotExist=true JDBC connect string for a JDBC metastore javax.jdo.option.ConnectionDriverName com.mysql.jdbc.Driver Driver class name for a JDBC metastore javax.jdo.option.ConnectionUserName username Username to use against metastore database hive.session.id temp0 hive.aux.jars.path file:///data/hive/lib/guava-14.0.1.jar,file:///data/hive/lib/protobuf-java-2.5.0.jar,file:///data/hive/lib/hbase-client-1.1.1.jar,file:///data/hive/lib/hbase-common-1.1.1.jar,file:///data/hive/lib/zookeeper-3.4.6.jar,file:///data/hive/lib/hbase-server-1.1.1.jar The location of the plugin jars that contain implementations of user defined functions and serdes. hive.querylog.location /data/hive/logs Location of Hive run time structured log file hive.zookeeper.quorum slave1,slave2,master,slave4,slave5,slave6,slave7 List of ZooKeeper servers to talk to. This is needed for: 1. Read/write locks - when hive.lock.manager is set to org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager, 2. When HiveServer2 supports service discovery via Zookeeper. 3. For delegation token storage if zookeeper store is used, if hive.cluster.delegation.token.store.zookeeper.connectString is not set hbase.zookeeper.quorum slave1,slave2,master,slave4,slave5,slave6,slave7 hive.server2.logging.operation.log.location /data/hive/logs/operation_logs Top level directory where operation logs are stored if logging functionality is enabled
修改配置文件后,启动metaStore的后台进程,执行hive就可进入hive的命令行了,执行insert into table hbase的表,执行成功。
到此,相信大家对“hive连接hbase外部表时insert数据报错怎么办”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款