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
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<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;
hadoop@hadoop-VirtualBox:~/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安装配置的更多相关文章
- Hive的安装配置
Hive的安装配置 Hive的安装配置 安装前准备 下载Hive版本1.2.1: 1.[root@iZ28gvqe4biZ ~]# wget http://mirror.bit.edu.cn/apac ...
- Linux下的Mysql安装 & 配置
Hive的数据,是存在HDFS里的.此外,hive有哪些数据库,每个数据库有哪些表,这样的信息称之为hive的元数据信息. 元数据信息不存在HDFS里.而是存在关系型数据库里,hive默认用的是der ...
- Linux(Manjaro) - Docker - MySQL 安装配置
Linux(Manjaro) - Docker - MySQL 安装配置 拉取mysql镜像 # 使用网易的 MySQL 镜像地址 docker pull hub.c.163.com/library/ ...
- MySQL---5、可视化工具Navicat for MySQL安装配置
一.安装文件包下载 Navicat for MySQL 安装软件和破解补丁: 链接:https://pan.baidu.com/s/1oKcErok_Ijm0CY9UjNMrnA 密码:4xb1 ...
- FreeRADIUS + MySQL 安装配置笔记
FreeRADIUS + MySQL 安装配置笔记 https://www.2cto.com/net/201110/106597.html
- mysql 安装配置及经常使用操作
作为关系型数据库的一种,mysql因其占用内存小和开源等特性而兴起.以下简介下关于mysql配置和简单的操作. mysql配置 1.安装文件的下载 免安装版下载地址 :http://dev.mysql ...
- Linux-CentOS7环境MySQL安装配置
Linux-CentOS7环境MySQL安装配置 1. 安装准备 (1)检查MySQL是否已安装 (2)如果有的话,就全部卸载 2. 安装libaio (1)检索相关信息: (2)安装依赖包: 3. ...
- Hive的mysql安装配置
一.MySQL的安装 Hive的数据,是存在HDFS里的.此外,hive有哪些数据库,每个数据库有哪些表,这样的信息称之为hive的元数据信息. 元数据信息不存在HDFS,而是存在关系型数据库里,hi ...
- 【转】hive简介安装 配置常见问题和例子
原文来自: http://blog.csdn.net/zhumin726/article/details/8027802 1 HIVE概述 Hive是基于Hadoop的一个数据仓库工具,可以将结构化 ...
- [Hive_2] Hive 的安装&配置
0. 说明 在安装好 Hadoop 集群和 ZooKeeper 分布式的基础上装好 MySQL,再进行 Hive 安装配置 1. 安装 1.1 将 Hive 安装包通过 Xftp 发送到 /home/ ...
随机推荐
- 57. Insert Interval
题目: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if nec ...
- Spring配置概述
1.Spring容器 1)要使应用程序中的Spring容器成功启动,需要以下三方面的条件都具备: · Spring架构的类包都已经放在应用程序的类路径下: · 应用程序为Spring提供完备的Bean ...
- 计算机技能get(windows系统)
1.快速打开程序,比如计算器,注册表,先按win键(不用再按win+r啦),输入程序名字,如calc,regedit等,直接打开. 2.自动左右分屏,win+上下左右方向键,win+↑ 最大化,win ...
- UDP protocol
Characteristics of the UDP protocol The UDP protocol (User Datagram Protocol) is a connectionless or ...
- Unrecognized selector sent to instance xxxxxxx
两个界面传递参数时报这个错误,经检查发现,是因为目标视图没有关联对应的controller.
- Android XML使用的学习记录
1. 注释其中一段代码或是一行,可以采用<!-- -->,示例如下 <!-- <EditText android:layout_width=&quo ...
- [Codeforces677B]Vanya and Food Processor(模拟,数学)
题目链接:http://codeforces.com/contest/677/problem/B 题意:n个土豆,每个土豆高ai.现在有个加工机,最高能放h,每次能加工k.问需要多少次才能把土豆全加工 ...
- LA 4127 - The Sky is the Limit (离散化 扫描线 几何模板)
题目链接 非原创 原创地址:http://blog.csdn.net/jingqi814/article/details/26117241 题意:输入n座山的信息(山的横坐标,高度,山底宽度),计算他 ...
- 函数mem_pool_fill_free_list
/********************************************************************//** Fills the specified free l ...
- 1493: [NOI2007]项链工厂
线段树. 真还就是个线段树.. 除去操作1,2的话,线段树很容易就处理了,问题在于如何处理操作1和2.(这点没想到).. 我们用一个delta维护操作1,如果没有旋转就+k,不然就-k. 每次读入i和 ...