---
title: "hadoop命令操作记录"
author: "conkeyn"
date: "2014-02-25T23:09:28Z"
tags: []
categories: ["编程语言"]
slug: "hadoop"
draft: false
lastmod: "2014-02-25T23:12:23Z"
id: 2022440
url: "https://conkeyn.iteye.com/blog/2022440"
---

**FS**

    1、使用-text参数将gzip和sequence file转换为文本格式并输出

        

```
$HADOOP_HOME/hadoop fs -text /sorted/part-00000 | head
```

 

**hadoop-example.\*.jar**

1、使用Hadoop自带示例JAR中的排序进行排序测试。下面示例中设定了输入格式为SequenceFile格式

```
$HADOOP_HOME/hadoop jar /home/conkeyn/hadoop-1.2.1/hadoop-examples-1.2.1.jar sort -r 1 -inFormat org.apache.hadoop.mapred.SequenceFileInputFormat -outFormat org.apache.hadoop.mapred.SequenceFileOutputFormat -outKey org.apache.hadoop.io.IntWritable -outValue org.apache.hadoop.io.Text /test-sequence.seq /sorted
```