hive-mysql安装配置

默认情况下,hive的元数据信息存储在内置的Derby数据中。Facebook将hive元数据存储在关系数据库

1、安装好mysql ,sudo apt-get install mysql-server

2、创建mysql用户hadoop

$ mysql -u root -p
进入root用户

mysql> CREATE USER ‘hadoop‘@‘localhost‘ IDENTIFIED
BY ‘hadoop‘;

3、授权:mysql> GRANT ALL PRIVILEGES ON *.* TO‘hadoop‘@‘localhost‘ WITH GRANT OPTION;

4、登录到hadoop
用户 $ mysql -u hadoop -p

5、创建数据库hive

mysql>create database hive;

6、修改hive中hive-site.xml

<property>
<name>hive.metastore.local</name>

<value>true</value>
<description>Thrift uri for the
remote metastore. Used by metastore client to connect to remote
metastore.</description>
</property>

<property>

<name>javax.jdo.option.ConnectionURL</name>

<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>

<description>JDBC connect string for a JDBC
metastore</description>
</property>

<property>

<name>javax.jdo.option.ConnectionDriverName</name>

<value>com.mysql.jdbc.Driver</value>
<description>Driver
class name for a JDBC metastore</description>
</property>

<property>

<name>javax.jdo.PersistenceManagerFactoryClass</name>

<value>org.datanucleus.jdo.JDOPersistenceManagerFactory</value>

<description>class implementing the jdo
persistence</description>
</property>

<property>

<name>javax.jdo.option.DetachAllOnCommit</name>

<value>true</value>
<description>detaches all objects
from session so that they can be used after transaction is
committed</description>
</property>

<property>

<name>javax.jdo.option.NonTransactionalRead</name>

<value>true</value>
<description>reads outside of
transactions</description>
</property>

<property>

<name>javax.jdo.option.ConnectionUserName</name>

<value>hadoop</value>
<description>username to use
against metastore database</description>
</property>

<property>

<name>javax.jdo.option.ConnectionPassword</name>

<value>hadoop</value>
<description>password to use
against metastore
database</description>
</property>
</configuration>

7、将mysql jdbc driver拷贝到hive的lib下

8、测试:

hive> create table tmp(info int);
OK
Time taken: 0.66
seconds
hive> show tables;
OK
tmp
Time taken: 0.138
seconds
hive> exit;
[email protected]:~/hive-0.10.0$ mysql -u
hadoop -p
Enter password:
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 50
Server version:
5.5.37-0ubuntu0.12.10.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights
reserved.

Oracle is a registered trademark of Oracle Corporation and/or
its
affiliates. Other names may be trademarks of their
respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input
statement.

mysql> use hive;
Reading table information for completion of table and
column names
You can turn off this feature to get a quicker startup with
-A

Database changed
mysql> show
tables;
+---------------------------+
| Tables_in_hive
|
+---------------------------+
| BUCKETING_COLS |
| CDS
|
| COLUMNS_V2 |
| DATABASE_PARAMS
|
| DBS |
| PARTITION_KEYS |
| SDS
|
| SD_PARAMS |
| SEQUENCE_TABLE
|
| SERDES |
| SERDE_PARAMS |
|
SKEWED_COL_NAMES |
| SKEWED_COL_VALUE_LOC_MAP |
|
SKEWED_STRING_LIST |
| SKEWED_STRING_LIST_VALUES |
| SKEWED_VALUES
|
| SORT_COLS |
| TABLE_PARAMS
|
| TBLS |
+---------------------------+
19 rows
in set (0.01 sec)

mysql> select * from
COLUMNS_V2;
+-------+---------+-------------+-----------+-------------+
|
CD_ID | COMMENT | COLUMN_NAME | TYPE_NAME | INTEGER_IDX
|
+-------+---------+-------------+-----------+-------------+
| 1 |
NULL | info | int | 0
|
+-------+---------+-------------+-----------+-------------+
1 row in set
(0.01 sec)

mysql> select * from tbls;
ERROR 1146 (42S02): Table ‘hive.tbls‘
doesn‘t exist
mysql> select * from
TBLS;
+--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+
|
TBL_ID | CREATE_TIME | DB_ID | LAST_ACCESS_TIME | OWNER | RETENTION | SD_ID |
TBL_NAME | TBL_TYPE | VIEW_EXPANDED_TEXT | VIEW_ORIGINAL_TEXT
|
+--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+
|
1 | 1399452288 | 1 | 0 | hadoop | 0 | 1 |
tmp | MANAGED_TABLE | NULL | NULL
|
+--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+
1
row in set (0.02 sec)

mysql> exit;

hive-mysql安装配置,布布扣,bubuko.com

时间: 2024-11-05 13:42:53

hive-mysql安装配置的相关文章

Hadoop+Hive+Mysql安装文档

2013-03-12 22:07 1503人阅读 评论(0) 收藏 举报  分类: Hadoop(13)  目录(?)[+] Hadoop+Hive+Mysql安装文档 软件版本 redhat enterprise server5.5 64 Hadoop 1.0.0 Hive 0.8.1 Mysql 5 Jdk 1.6 整体构架 共有7台机器,做4个数据节点,将name节点.jobtracker和secondaryname都分开,各机器分工如下 机器ip 主机名 用途 备注 123.456.78

Hadoop系列之Hive(数据仓库)安装配置

Hadoop系列之Hive(数据仓库)安装配置1.在NameNode安装  cd /root/soft  tar zxvf apache-hive-0.13.1-bin.tar.gz   mv apache-hive-0.13.1-bin /usr/local/hadoop/hive2. 配置环境变量(每个节点都需要增加) 打开/etc/profile #添加以下内容: export HIVE_HOME=/usr/local/hadoop/hive export PATH=$HIVE_HOME/

Redhat下Mysql安装配置

环境信息 ------------------------------------------------------------ RHEL 6 -x86_64 yum(如未安装yum,请先安装yum,参考:安装及源配置) ------------------------------------------------------------ 安装mysql yum搜索mysql yum search mysql 搜索结果如下 MySQL-python.x86_64 : An interface

openvpn+mysql安装配置

科普: 1.当今流行的4种vpn:pptp l2tp(相比pptp支持隧道验证) ipsec(cisco) sslvpn(openvpn). 2.openvpn可用于代理http:不同机房间服务器安装连接等. 以下是本人根据搜集的相关文档,重新整理,以备查阅. ====================================================================================== 实验环境: CentOS release 6.3 x64 外网:

Mysql安装配置,修改初试密码。

绿色版本,解压缩 D:\Software\mysql-advanced-5.6.18-winx64 my-default.ini 改名my.ini my.ini内容如下 # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It's a tem

Linux Apache php MySQL 安装配置(Centos 6.4 yum安装)

一.yum准备 1.Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器. 基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载.安装. 2.在安装软件时报’Couldn't resolve host 'mirrorlist.centos.org‘ 解决:打开文件/etc/resolv.conf在其中添加: (添

Hive的mysql安装配置

一.MySQL的安装 Hive的数据,是存在HDFS里的.此外,hive有哪些数据库,每个数据库有哪些表,这样的信息称之为hive的元数据信息. 元数据信息不存在HDFS,而是存在关系型数据库里,hive默认用的是derby数据库来存储.即hive工作时,除了要依赖Hadoop,还要依赖关系型数据库. 注意:虽然我们能通过HDFS查看到hive有哪些数据库,有哪些表,以及表里的数据,但是,这不是元数据信息.HDFS最主要的是存储hive的数据信息. 之前遇到的问题:当退出后,切换到不同的目录来进

ubuntu下MySQL安装配置及基本操作

在linux下安装方法: 分为四种:一: 直接用软件仓库自动安装(如:ubuntu下,sudo apt-get install mysql-server; Debain下用yum安装): 二:官网下载deb或rmp安装包,直接双击安装: 三:下载tar安装包,解压到硬盘,然后自己配置mysql: 四:源码编译安装(下载mysql源代码自己编译安装). 前两种不需要自己配置,安装简单:后两种需自行配置文件,需要对mysql较为熟练.主要讲下第三种. 由于MySQL依赖libaio1包,所以先安装l

Linux MySQL安装配置

官方下载地址:http://dev.mysql.com/downloads/mysql/ 1. 下载合适的版本,解压到 /usr/local/mysql 目录下: 2. 进行到 /usr/local/mysql 目录下,创建 data/mysql 目录,后面将会设置把数据库保存在此目录下: 3. 添加用户和用户组 #添加用户组 groupadd mysql #添加用户mysql 到用户组mysql useradd -g mysql mysql 3.1 useradd -r -s /sbin/no

linux下 php+nginx+mysql安装配置

我主要是用来安装php,以及nginx和php的交互.原文:http://www.cnblogs.com/lost-1987/articles/2642979.html 一 安装插件 可以选择YUM安装或者源码编译安装 gcc gcc-c++ zlib pcre pcre-devel libevent libevent-devel libxml2 libxml2-devel libmcrypt libmcrypt-devel curl-devel libpng-devel libtool-ltd