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/ ...
随机推荐
- WCF入门(九)--WCF实例管理
这组由Windows通讯基础(WCF)结合一组消息(客户端请求)服务实例所采用的技术被称为实例管理.一个完全由三种类型实例激活支持WCF,它们如下所述. 1.每个调用服务 每次调用服务是Windows ...
- JDBC学习总结(二)
1.JDBC的基本应用 1)创建数据库: create database test; use test; 2)创建表: create table student( id int(4) no ...
- javascript grunt安装和使用
grunt是javascript世界的构建工具. 为何要用构建工具? 一句话:自动化.对于需要反复重复的任务,例如压缩(minification).编译.单元测试.linting等.自动化工具可以减轻 ...
- [CF676C]Vasya and String(尺取法,原题)
题目链接:http://codeforces.com/contest/676/problem/C 原题题解链接:http://www.cnblogs.com/vincentX/p/5405468.ht ...
- [HZAU]华中农业大学第四届程序设计大赛网络同步赛
听说是邀请赛啊,大概做了做…中午出去吃了个饭回来过掉的I.然后去做作业了…… #include <algorithm> #include <iostream> #include ...
- NGUI监听事件
using UnityEngine; using System.Collections; public class UIDataHandler : MonoBehaviour { public UII ...
- ImageView的属性android:scaleType,即ImageView.setScaleType(ImageView.ScaleType)
1 imageView.setScaleType(ImageView.ScaleType.FIT_XY ); 1 这里我们重点理解ImageView的属性android:scaleType,即Imag ...
- if(username.equals(“zxx”){}
1. if(username.equals(“zxx”){} username可能为NULL,会报空指针错误:改为"zxx".equals(username) 2. int x ...
- iOS开发:Swift多线程NSThread的使用
一:创建线程,NSThread创建线程常用的三种方式: //1:手动创建启动 let thread:NSThread = NSThread(target: self, selector:"d ...
- Web网站的性能测试工具
随着Web 2.0技术的迅速发展,许多公司都开发了一些基于Web的网站服务,通常在设计开发Web应用系统的时候很难模拟出大量用户同时访问系统的实际情况,因此,当Web网站遇到访问高峰时,容易发生服务器 ...