关于Hive的问题 [英] Questions about Hive

查看:122
本文介绍了关于Hive的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的环境:


  • 具有多个应用程序的Haddop环境(1个主站,4个从站):
    ambari,hue ,hive,sqoop,hdfs ...使用mysql数据库生产服务器(与hadoop分离
    )。



我的目标是:




  • 优化在此mysql服务器上进行的查询,这些查询对于
    执行速度很慢。



我做了什么:


  • 我将mysql数据导入HDFS使用Sqoop。



我的疑惑:


  1. 我无法使用Hive在HDFS中直接进行选择?

  2. 是否必须将数据加载到Hive中并进行查询?

  3. 如果新增数据输入到mysql数据库中,获取这些数据并将其插入HDFS然后再插入到
    Hive中的最佳方式是
    ? (也许是实时的)

预先感谢您

解决方案


我无法使用Hive在HDFS中直接进行选择?


您能够。创建 外部表格 在配置单元中指定您的hdfs位置。然后你可以执行任何HQL。


我必须将数据加载到Hive并进行查询吗?


如果使用外部表,则不需要在配置单元中加载数据;你的数据驻留在同一个HDFS目录中。


如果新数据输入到mysql数据库中,获取这些数据的最佳方式是什么。


您可以使用Sqoop 增量导入 。它将仅提取新添加/更新的数据(取决于增量模式)。您可以创建 sqoop作业 并根据您的需要安排它。


I have this environment:

  • Haddop environment (1 master, 4 slaves) with several applications: ambari, hue, hive, sqoop, hdfs ... Server in production (separate from hadoop) with mysql database.

My goal is:

  • Optimize the queries made on this mysql server that are slow to execute today.

What did I do:

  • I imported the mysql data to HDFS using Sqoop.

My doubts:

  1. I can not make selects direct in HDFS using Hive?
  2. Do I have to load the data into Hive and make the queries?
  3. If new data is entered into the mysql database, what is the best way to get this data and insert it into HDFS and then insert it into Hive again? (Maybe in real time)

Thank you in advance

解决方案

I can not make selects direct in HDFS using Hive?

You can. Create External Table in hive specifying your hdfs location. Then you can perform any HQL over it.

Do I have to load the data into Hive and make the queries?

In case of external table, you don't need to load data in hive; your data resides in the same HDFS directory.

If new data is entered into the mysql database, what is the best way to get this data.

You can use Sqoop Incremental Import for this. It will fetch only newly added/updated data (depending upon incremental mode). You can create a sqoop job and schedule it as per your need.

这篇关于关于Hive的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆