(大数据之hive)hive利用mysql存储metastore
来源:互联网 发布:python的正则表达式 编辑:程序博客网 时间:2024/06/07 20:45
1.上传hive安装包
2.解压
3.配置
3.1安装mysql
查询以前安装的mysql相关包
rpm -qa | grep mysql
暴力删除这个包
rpm -e mysql-libs-5.1.66-2.el6_3.i686 --nodeps
rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm
rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm
执行命令设置mysql
/usr/bin/mysql_secure_installation
将hive添加到环境变量当中
GRANT ALL PRIVILEGES ON hive.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
FLUSH PRIVILEGES
在hive当中创建两张表
create table trade_detail (id bigint, account string, income double, expenses double, time string) row format delimited fields terminated by '\t';
create table user_info (id bigint, account string, name string, age int) row format delimited fields terminated by '\t';
将mysq当中的数据直接导入到hive当中
sqoop import --connect jdbc:mysql://192.168.1.10:3306/itcast --username root --password 123 --table trade_detail --hive-import --hive-overwrite --hive-table trade_detail --fields-terminated-by '\t'
sqoop import --connect jdbc:mysql://192.168.1.10:3306/itcast --username root --password 123 --table user_info --hive-import --hive-overwrite --hive-table user_info --fields-terminated-by '\t'
创建一个result表保存前一个sql执行的结果
create table result row format delimited fields terminated by '\t' as select t2.account, t2.name, t1.income, t1.expenses, t1.surplus from user_info t2 join (select account, sum(income) as income, sum(expenses) as expenses, sum(income-expenses) as surplus from trade_detail group by account) t1 on (t1.account = t2.account);
create table user (id int, name string) row format delimited fields terminated by '\t'
将本地文件系统上的数据导入到HIVE当中
load data local inpath '/root/user.txt' into table user;
创建外部表
create external table stubak (id int, name string) row format delimited fields terminated by '\t' location '/stubak';
创建分区表
普通表和分区表区别:有大量数据增加的需要建分区表
create table book (id bigint, name string) partitioned by (pubdate string) row format delimited fields terminated by '\t';
分区表加载数据
load data local inpath './book.txt' overwrite into table book partition (pubdate='2010-08-22');
2.解压
3.配置
3.1安装mysql
查询以前安装的mysql相关包
rpm -qa | grep mysql
暴力删除这个包
rpm -e mysql-libs-5.1.66-2.el6_3.i686 --nodeps
rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm
rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm
执行命令设置mysql
/usr/bin/mysql_secure_installation
将hive添加到环境变量当中
GRANT ALL PRIVILEGES ON hive.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
FLUSH PRIVILEGES
在hive当中创建两张表
create table trade_detail (id bigint, account string, income double, expenses double, time string) row format delimited fields terminated by '\t';
create table user_info (id bigint, account string, name string, age int) row format delimited fields terminated by '\t';
将mysq当中的数据直接导入到hive当中
sqoop import --connect jdbc:mysql://192.168.1.10:3306/itcast --username root --password 123 --table trade_detail --hive-import --hive-overwrite --hive-table trade_detail --fields-terminated-by '\t'
sqoop import --connect jdbc:mysql://192.168.1.10:3306/itcast --username root --password 123 --table user_info --hive-import --hive-overwrite --hive-table user_info --fields-terminated-by '\t'
创建一个result表保存前一个sql执行的结果
create table result row format delimited fields terminated by '\t' as select t2.account, t2.name, t1.income, t1.expenses, t1.surplus from user_info t2 join (select account, sum(income) as income, sum(expenses) as expenses, sum(income-expenses) as surplus from trade_detail group by account) t1 on (t1.account = t2.account);
create table user (id int, name string) row format delimited fields terminated by '\t'
将本地文件系统上的数据导入到HIVE当中
load data local inpath '/root/user.txt' into table user;
创建外部表
create external table stubak (id int, name string) row format delimited fields terminated by '\t' location '/stubak';
创建分区表
普通表和分区表区别:有大量数据增加的需要建分区表
create table book (id bigint, name string) partitioned by (pubdate string) row format delimited fields terminated by '\t';
分区表加载数据
load data local inpath './book.txt' overwrite into table book partition (pubdate='2010-08-22');
0 0
- (大数据之hive)hive利用mysql存储metastore
- hive安装过程:metastore(元数据存储)的三种方式之本地mysql方式
- hive安装过程:metastore(元数据存储)的三种方式之远端mysql方式
- 使用mysql存储存储hive的metastore
- 【hive】mysql metastore 配置
- Hive metastore MYSQL配置
- Hive学习之配置MySQL为Metastore
- Hive 之使用mysql作为hive的metastore
- hive安装过程:metastore(元数据存储)的三种方式之本地derby方式
- hive使用mysql保存metastore
- hive使用mysql保存metastore
- hive使用mysql保存metastore
- Hive使用MySQL保存Metastore
- Hive之 数据存储
- (大数据之hive)hive安装
- Hive metastore三种存储方式
- Hive metastore三种存储方式
- Hive metastore三种存储方式
- CUDA程序中error MSB3721解决方式
- POJ 2559 Largest Rectangle in a Histogram
- 局部变量与函数返回地址(大学课件整理)
- PHP设计模式之:单例模式
- VS2013中右键添加菜单
- (大数据之hive)hive利用mysql存储metastore
- Install: Django
- Codeforces Round #305 Mike and Feet(单调栈)
- 事务
- 一个storm的完整例子——WordCount
- 动态代理在JDBC的DataSource中的应用
- 2015编程之美 彩色的树
- iOS编程——面向对象的编程
- (大数据之hive)hive联表查询、创建外部表练习