1、添加环境变量:vi ~/.bashrc

#HIVE VARIABLES START
export HIVE_HOME=/usr/local/hive-1.2.1
export PATH=$PATH:$HIVE_HOME/bin
export CLASSPATH=$CLASSPATH:$HIVE_HOME/lib //可以不配
export HIVE_CONF_DIR=$HIVE_HOME/conf //可以不配
#HIVE VARIABLES END

2、替换Hadoop下的lib

cp /usr/local/hive-1.2.1/lib/jline-2.12.jar  /usr/local/hadoop-2.6.0/share/hadoop/yarn/lib/
rm -rf jline-0.9.94.jar

3、修改配置文件

cp hive-default.xml.template hive-default.xml
cp hive-default.xml.template hive-site.xml
//一下三项可以不配
cp hive-exec-log4j.properties.template hive-exec-log4j.properties
cp hive-log4j.properties.template hive-log4j.properties
cp beeline-log4j.properties.template beeline-log4j.properties

把几个带.template后缀的模板文件,复制一份变成不带.template的配置文件,注意hive-default.xml.template这个要复制二份,一个是hive-default.xml,另一个是hive-site.xml,其中hive-site.xml为用户自定义配置,hive-default.xml为全局配置,hive启动时,-site.xml自定义配置会覆盖-default.xml全局配置的相同配置项。

hive-site.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration>
<property> //该项可以不配
<name>hive.metastore.local</name>
<value>true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
</property>
<property>
<name>hive.exec.scratchdir</name>
<value>/tmp/hive</value>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
</configuration>

4、Mac下mysql安装

 sudo apt-get install mysql-server
 apt-get isntall mysql-client
 sudo apt-get install libmysqlclient-dev

5、添加mysql-connector

下载mysql-connector-java-3.1.12-bin.jar文件,并放到$HIVE_HOME/lib目录下

6、mysql权限设置

mysql.server start
mysql -uroot -p

建立数据库hive,并设定为latin1编码

create database hive default character set latin1;

创建用户hive

create user 'hive'@'%' identified by 'hive';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' WITH GRANT OPTION;
grant all on hive.* to hive@'localhost' identified by 'hive';
flush privileges;

图形界面搭建:

http://blog.csdn.net/ggz631047367/article/details/49979109

Hive使用:

http://my.oschina.net/leejun2005/blog/120463

出错记录:

问题1:

Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
……
NestedThrowables:
java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true, username = hive. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
java.sql.SQLException: Access denied for user 'hive'@'localhost' (using password: YES)
……
Caused by: java.sql.SQLException: Access denied for user 'hive'@'localhost' (using password: YES)

解决:

mysql -uroot -p
grant all on hive.* to hive@’localhost’ identified by ’hive’;
flush privileges;

问题2:

Logging initialized using configuration in jar:file:/hive/apache-hive-1.1.0-bin/lib/hive-common-1.1.0.jar!/hive-log4j.properties
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/hadoop-2.5.2/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/hive/apache-hive-1.1.0-bin/lib/hive-jdbc-1.1.0-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)
at jline.TerminalFactory.get(TerminalFactory.java:158)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:229)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:209)
at org.apache.hadoop.hive.cli.CliDriver.getConsoleReader(CliDriver.java:773)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:715)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

解决方法是:

将hive下的新版本jline的JAR包拷贝到hadoop下:

cp /usr/local/hive-1.2.1/lib/jline-2.12.jar  /usr/local/hadoop-2.6.0/share/hadoop/yarn/lib/
rm -rf jline-0.9.94.jar

ubuntu14.04配置Hive1.2.1的更多相关文章

  1. Caffe+CUDA7.5+CuDNNv3+OpenCV3.0+Ubuntu14.04 配置参考文献 以及 常见编译问题总结

    Caffe+CUDA7.5+CuDNNv3+OpenCV3.0+Ubuntu14.04  配置参考文献 ---- Wang Xiao Warning: Please make sure the cud ...

  2. Caffe+CUDA8.0+CuDNNv5.1+OpenCV3.1+Ubuntu14.04 配置参考文献 以及 常见编译问题总结

    Caffe + CUDA8.0 + CuDNNv5.1 + OpenCV3.1 + Ubuntu14.04  配置参考文献 ---- Wang Xiao  Anhui University  CVPR ...

  3. Ubuntu14.04配置gcc4.4.4+Qt4.8.4交叉编译环境

    安装32位程序运行支持 sudo apt-get install lib32stdc++6 lib32z1 lib32ncurses5 lib32bz2-1.0 可能报错: lib32stdc++6 ...

  4. ubuntu14.04 配置网络

    ubuntu14.04 配置网络的练习 本文参考的资料: https://blog.csdn.net/liu782726344/article/details/52912797. 感谢作者的分享! 打 ...

  5. Ubuntu14.04配置Mono+Jexus

    总所周知,ASP.NET是微软公司的一项技术,是一个网站服务端开发的一种技术,它可以在通过HTTP请求文档时再在Web服务器上动态创建它们,就是所谓动态网站开发,它依赖运行于 IIS 之中的程序 .但 ...

  6. ubuntu14.04 配置中文输入法

    ubuntu14.04自带中文输入法,只要配置就可以了. 1.安装中文支持 System Settings -->  Language Support 点击 install/remove lan ...

  7. ubuntu14.04配置中文latex完美环境(texlive+texmaker+lyx)

    Ubuntu下的文档编辑虽然有libreoffice,但对中文和公式的排版始终不如ms office,因此要想写出高质量的文档,只能靠latex了,现在随着xeCjk的开发,中文文档在ubuntu下的 ...

  8. 64位ubuntu14.04配置adb后提示没有那个文件或目录

    1.配置完adb环境变量后在终端输入adb: ameyume@ameyume-HP-450-Notebook-PC:~$ adb /home/ameyume/adt-bundle-linux-x86_ ...

  9. ubuntu14.04 配置tomcat8

    ubuntu下配置tomcat的过程事实上和windows是差点儿相同的,以下一起来看一下怎样在ubuntu14.04中配置tomcat. 1.下载tomcat 地址:http://tomcat.ap ...

随机推荐

  1. php xdebug xampp eclipse

    Eclipse配置 一:配置workspace 打开Eclipse for PHP Developers,需要设置workspace,这个必须设置到C:\xampp\htdocs目录,否则待会无法进行 ...

  2. 【并发编程】AQS学习

    一个简单的示例: package net.jcip.examples; import java.util.concurrent.locks.*; import net.jcip.annotations ...

  3. LVS包转发模型和调度算法(转)

    LVS简介 Internet的快速增长使多媒体网络服务器面对的访问数量快速增加,服务器需要具备提供大量并发访问服务的能力,因此对于大负载的服务器来 讲, CPU.I/O处理能力很快会成为瓶颈.由于单台 ...

  4. android学习笔记20——ProgressDialog进度条对话框

    ProgressDialog==>进度条对话框 ProgressDialog本身就代表一个进度条对话框,程序只需要创建ProgressDialog实例,并将其显示出来就是一个进度条对话框:开发者 ...

  5. VS合集/6.0/2005/2008/2010/2012/2013 绿色版精简版

    VS合集/6.0/2005/2008/2010/2012/2013 绿色版精简版 找到这里的都是老司机,别的不多说了 链接: http://pan.baidu.com/s/1i5IyYZb       ...

  6. Page.User.Identity.Name获取不到结果

    如果在IIS部署后Page.User.Identity.Name获取不到值,需要检查以下设置: 1.web.config设置<authentication mode="Windows& ...

  7. smartgit document Rebase

    The Rebase command allows you to apply commits from one branch to another. Rebase can be viewed as m ...

  8. HDU 1532 (Dinic算法)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1532 题目大意: 就是由于下大雨的时候约翰的农场就会被雨水给淹没,无奈下约翰不得不修建水沟,而且是网络 ...

  9. Tesseract训练笔记

    [参考] http://www.cnblogs.com/samlin/p/Tesseract-OCR.html https://code.google.com/p/tesseract-ocr/wiki ...

  10. maven下载的jar文件出现invalid LOC header (bad signature)

    有的时候maven下载了相对应的jar文件,但是某些类无法被引入,在eclipse打开该jar文件,发现相对应的类是invalid LOC header (bad signature),这时把mave ...