---
title: "hadoop & hive 学习"
author: "blgaici1"
date: "2014-12-03T10:49:28Z"
tags: []
categories: ["开源软件"]
slug: "hadoop-hive"
draft: false
lastmod: "2014-12-03T15:06:07Z"
id: 2162820
url: "https://kevin1.iteye.com/blog/2162820"
---

1.启动hive

```java

hive

```

2.显示所有表

```java

show tables;

```

3.查看表的内容

```java

describe t_app;

```

4.hive导文件到本地

```java

hive -e "select * from t_app where apk_id < 1000000 " > /home/hadoop/armmy

or

hive -e "insert overwrite local directory '/recommend/armmy/' select * from t_app where apk_id < 1000000 "  

```

5.hive 导文件到hdfs上

```java

hive -e "insert overwrite directory '/recommend/armmy/' select * from t_app where apk_id < 1000000 "  

```

6.启动hadoop作业

```java

hadoop jar /home/hadoop/armmy/AlbumHadoopJob-1.0.jar com.hadoop.run.WallPaperRunMain  > /home/hadoop/armmy/album_correct

```

7.hdfs文件导入hive

```java

load data inpath '/home/wyp/add.txt' into table wyp;

```

8.本地文件导入hive中

```java

load data local inpath 'wyp.txt' into table wyp;

```


```python

8、9请查考
http://blog.csdn.net/lifuxiangcaohui/article/details/40588929

```