Prerequisite:

Hadoop cluster is avalable;

Mysql installed on namenode;

Step1: download the latest hive tar packages and extract .

Download:http://apache.dataguru.cn/hive/hive-0.12.0/

tar xvf tar xvf hive-0.12..tar.gz

Step2: set the environment for hive.

# su to root add hive home

Vim /etc/profile

export HIVE_HOME=/home/hadoop/hive/hive-0.12.

export PATH =$PATH:$HIVE_HOME/bin;

Step3: do this in mysql Create the connection user hive with password hive.

mysql –u root –p

CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';

GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' WITH GRANT OPTION;

flush privileges;

Step4: copy the mysql connector to hive/lib folder.

copy mysql-connector-java-5.1.-bin.jar to hive/lib/

Step5:update the hive-site.xml

Vim hive-site.xml

The sample content is following:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property> <name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://namenode:3306/hive?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=latin1</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.metastore.schema.verification</name>
<value>false</value>
</property>
<property> <name>hive.stats.dbconnectionstring</name>
<value>jdbc:mysql://namenode:3306/hive_stats?useUnicode=true&amp;characterEncoding=latin1&amp;user=hive&amp;password=hive&amp;createDatabaseIfNotExist=true</value>
<description>The default connection string for the database that stores temporary hive statistics.</description> </property> <property>
<name>hive.stats.dbconnectionstring</name>
<value>jdbc:mysql://namenode:3306/hive_stats?useUnicode=true&amp;characterEncoding=utf8&amp;user=hive&amp;password=hive&amp;createDatabaseIfNotExist=true</value>
</property> <property>
<name>hive.stats.dbclass</name>
<value>jdbc:mysql</value>
</property> <property>
<name>hive.stats.jdbcdriver</name>
<value>com.mysql.jdbc.Driver</value>
</property> </configuration>

Step6: hive shell, test the install.

Hive;

Show tables;

Then you can go to mysql , check the metastore database hive,

Show tables to check the metastore tables in mysql.

Step7:quick start:

create table student(sid int,sname string) row format delimited fields terminated by '\t' stored as textfile;

load data local inpath '/home/hadoop/data/student.txt' overwrite into table student;

select * from student;

cd /data

vim student.txt
yaoxiaohua
yaoyuanyie
yaotianyie

我一开始在安装的时候,hive启动还总是出一些问题,是hive-site.xml的配置造成的.

可以开启调试模试,根据日志查找原因.

启动调试模式进行操作:

hive -hiveconf hive.root.logger=DEBUG,console

我的mysql安装的比较早,一开始居然忘记root密码了,如果你也遇到了这种情况,

可以参见:

http://blog.sina.com.cn/s/blog_4488002e0100z574.html

主要思路是使用安全登录命令,然后update user表的信息.

mysqld_safe --skip-grant-tables 

可能会用到的一些命令:

rpm -qa | grep mysql  // 这个命令就会查看该操作系统上是否已经安装了mysql数据库

Service mysqld status //检查mysqld的状态

Chkconfig mysqld on //设置开机自动启动mysql服务

Hive remote install mode (mysql) step by step的更多相关文章

  1. Step by step Install a Local Report Server and Remote Report Server Database

    原创地址:http://www.cnblogs.com/jfzhu/p/4012097.html 转载请注明出处 前面的文章<Step by step SQL Server 2012的安装 &g ...

  2. 安装Hive(独立模式 使用mysql连接)

    安装Hive(独立模式 使用mysql连接) 1.默认安装了java+hadoop 2.下载对应hadoop版本的安装包 3.解压安装包 tar zxvf apache-hive-1.2.1-bin. ...

  3. Step by step guide to set up master and slave machines(转)

    Note: There is no need to install Jenkins on the slave machine. On your master machine go to Manage ...

  4. Step by step guide to set up master and slave machines on Windows

    Note: There is no need to install Jenkins on the slave machine. On your master machine go to Manage ...

  5. Step by step Dynamics CRM 2013安装

    原创地址:http://www.cnblogs.com/jfzhu/p/4008391.html 转载请注明出处   SQL Server可以与CRM装在同一台计算机上,也可安装在不同的计算机上.演示 ...

  6. Tomcat Clustering - A Step By Step Guide --转载

    Tomcat Clustering - A Step By Step Guide Apache Tomcat is a great performer on its own, but if you'r ...

  7. HIve体系结构,hive的安装和mysql的安装,以及hive的一些简单使用

    Hive体系结构: 是建立在hadoop之上的数据仓库基础架构. 和数据库相似,只不过数据库侧重于一些事务性的一些操作,比如修改,删除,查询,在数据库这块发生的比较多.数据仓库主要侧重于查询.对于相同 ...

  8. e2e 自动化集成测试 架构 实例 WebStorm Node.js Mocha WebDriverIO Selenium Step by step (四) Q 反回调

    上一篇文章“e2e 自动化集成测试 架构 京东 商品搜索 实例 WebStorm Node.js Mocha WebDriverIO Selenium Step by step (三) SqlServ ...

  9. e2e 自动化集成测试 架构 实例 WebStorm Node.js Mocha WebDriverIO Selenium Step by step (三) SqlServer数据库的访问

    上一篇文章“e2e 自动化集成测试 架构 京东 商品搜索 实例 WebStorm Node.js Mocha WebDriverIO Selenium Step by step 二 图片验证码的识别” ...

随机推荐

  1. 【循序渐进学Python】10.模块和包

    1.导入模块 任何Python程序都可以作为模块导入,只要Python解释器能找到我们定义的模块所在位置即可,一般来讲,在一个模块被导入时,Python解释器会按照下面的步骤进行搜索: 在当前所在目录 ...

  2. C#方法的六种参数,值参数、引用参数、输出参数、参数数组、命名参数、可选参数

    方法的参数有六种,分别是值参数.引用参数.输出参数.参数数组.命名参数.可选参数. 值参数 值参数是方法的默认类型,通过复制实参的值到形参的方式把数据传递到方法,方法被调用时,系统作两步操作: 在栈中 ...

  3. sql server2008安装错误(无法处理异常)

    我在安装sql server2008时出现安装错误,无法处理的异常,问题如下: 解决方法:在地址栏输入C:\Users\Administrator\AppData\Local ,找到Microsoft ...

  4. 重新想象 Windows 8 Store Apps (51) - 输入: 涂鸦板

    [源码下载] 重新想象 Windows 8 Store Apps (51) - 输入: 涂鸦板 作者:webabcd 介绍重新想象 Windows 8 Store Apps 之 涂鸦板 通过 Poin ...

  5. python之import机制

    1. 标准 import        Python 中所有加载到内存的模块都放在 sys.modules .当 import 一个模块时首先会在这个列表中查找是否已经加载了此模块,如果加载了则只是将 ...

  6. wrong requestcode when using startActivityForResult

    You are calling startActivityForResult() from your Fragment. When you do this, the requestCode is ch ...

  7. struts2 java.lang.StackOverflowError org.apache.struts2.json.JSONWriter

    1. 问题描述: 页面通过异步访问action,    action的方法通过map封装数据,struts的result的type设置为json,后台报错 六月 25, 2016 6:54:33 下午 ...

  8. double 类型转化为Integer类型 ---DecimalFormat

    假设x是你要转换的double类型变量: 不进行四舍五入操作: (int)x 进行四舍五入操作: Integer.parseInt(new java.text.DecimalFormat(" ...

  9. FAQ_1_陌生的VERSION.SDK_INT

    看到VERSION.SDK_INT不禁诧异,这是何物?! 看API的定义,如下: 原来是一个常量值.但是这个常量值可以根据系统的不同而不同哟!为了揭开其神秘的面纱,将源码ctrl如下: 可以看出,获取 ...

  10. css实现垂直居中的方法

    1,设置其line-height值,使之与其高度相同 2,设置table结构,用vertical-align:middle; 3,应用定位,父级别:position:relative:子级:posit ...