您好,欢迎访问一九零五行业门户网

手动安装cloudera cdh4.2 hadoop + hbase + hive(三)

本文主要记录手动安装cloudera hive cdh4.2.0集群过程,环境设置及hadoop、hbase安装过程见上篇文章。 安装hive hive安装在desktop1上,注意hive默认是使用derby数据库保存元数据,这里替换为postgresql,下面会提到postgresql的安装说明,并且需要拷贝postg
本文主要记录手动安装cloudera hive cdh4.2.0集群过程,环境设置及hadoop、hbase安装过程见上篇文章。
安装hivehive安装在desktop1上,注意hive默认是使用derby数据库保存元数据,这里替换为postgresql,下面会提到postgresql的安装说明,并且需要拷贝postgres的jdbc jar文件导hive的lib目录下。
上传文件上传hive-0.10.0-cdh4.2.0.tar到desktop1的/opt,并解压缩
安装postgres创建数据库这里创建数据库metastore并创建hiveuser用户,其密码为redhat。
psql -u postgrescreate database metastore; \c metastore;create user hiveuser with password 'redhat';grant all on database metastore to hiveuser;\q
初始化数据库
psql -u hiveuser -d metastore \i /opt/hive-0.10.0-cdh4.2.0/scripts/metastore/upgrade/postgres/hive-schema-0.10.0.postgres.sql
编辑postgresql配置文件,修改访问权限
[root@desktop1 ~]# vi /opt/postgresql/9.1/data/pg_hba.conf# ipv4 local connections:host all all 0.0.0.0/0 md5[root@desktop1 ~]# vi postgresql.confstandard_conforming_strings = off
重起postgres
su -c '/opt/postgresql/9.1/bin/pg_ctl -d /opt/postgresql/9.1/data restart' postgres
拷贝postgres 的jdbc驱动到/opt/hive-0.10.0-cdh4.2.0/lib修改配置文件hive-site.xml 注意修改下面配置文件中postgres数据库的密码,注意配置hive.aux.jars.path,在hive集成hbase时候需要从该路径家在hbase的一些jar文件。
[root@desktop1 ~]# cd /opt/hive-0.10.0-cdh4.2.0/conf/[root@desktop1 conf]# cat hive-site.xml javax.jdo.option.connectionurljdbc:postgresql://127.0.0.1/metastorejdbc connect string for a jdbc metastorejavax.jdo.option.connectiondrivernameorg.postgresql.driverdriver class name for a jdbc metastorejavax.jdo.option.connectionusernamehiveuserusername to use against metastore databasejavax.jdo.option.connectionpasswordredhatpassword to use against metastore databasemapred.job.trackerdesktop1:8031mapreduce.framework.nameyarnhive.aux.jars.pathfile:///opt/hive-0.10.0-cdh4.2.0/lib/zookeeper-3.4.5-cdh4.2.0.jar, file:///opt/hive-0.10.0-cdh4.2.0/lib/hive-hbase-handler-0.10.0-cdh4.2.0.jar, file:///opt/hive-0.10.0-cdh4.2.0/lib/hbase-0.94.2-cdh4.2.0.jar, file:///opt/hive-0.10.0-cdh4.2.0/lib/guava-11.0.2.jarhive.metastore.warehouse.dir/opt/data/warehouse-${user.name}location of default database for the warehousehive.exec.scratchdir/opt/data/hive-${user.name}scratch space for hive jobshive.querylog.location/opt/data/querylog-${user.name} location of hive run time structured log file hive.support.concurrencyenable hive's table lock manager servicetruehive.zookeeper.quorumzookeeper quorum used by hive's table lock managerdesktop3,desktop4,desktop6,desktop7,desktop8hive.hwi.listen.hostdesktop1this is the host address the hive web interface will listen onhive.hwi.listen.port9999this is the port the hive web interface will listen onhive.hwi.war.filelib/hive-hwi-0.10.0-cdh4.2.0.warthis is the war file with the jsp content for hive web interface
环境变量参考hadoop中环境变量的设置
启动脚本在启动完之后,执行一些sql语句可能会提示错误,如何解决错误可以参考hive安装与配置。
[root@desktop1 ~] hive
hive与hbase集成 在hive-site.xml中配置hive.aux.jars.path,在环境变量中配置hadoop、mapreduce的环境变量异常说明failed: error in metadata: metaexception(message:org.apache.hadoop.hbase.zookeeperconnectionexception: an error is preventing hbase from connecting to zookeeper原因:hadoop配置文件没有zk
failed: error in metadata: metaexception(message:got exception: org.apache.hadoop.hive.metastore.api.metaexception javax.jdo.jdodatastoreexception: error executing jdoql query select this.tbl_name as nucorder0 from tbls this left outer join dbs this_database_name on this.db_id = this_database_name.db_id where this_database_name.name = ? and (lower(this.tbl_name) like ? escape '\' ) order by nucorder0 : error: invalid escape string 建议:escape string must be empty or one character..参考:https://issues.apache.org/jira/browse/hive-3994
hive> select count(*) from hive_userinfo; 没反应
zookeeper.clientcnxn (clientcnxn.java:logstartconnect(966)) - opening socket connection to server localhost/127.0.0.1:2181. will not attempt to authenticate using sasl (无法定位登录配置)
原因:hive中没有设置zk
hbase 中提示:warn util.nativecodeloader: unable to load native-hadoop library for your platform... using builtin-java classes where applicable原因:cloudera hadoop lib中没有hadoop的native jar
exception in thread main java.lang.noclassdeffounderror: org/apache/hadoop/mapreduce/v2/app/mrappmaster原因:classpath没有配置正确,检查环境变量以及yarn的classpath
其它类似信息

推荐信息