如何查看hadoop集群是否安装成功(用jps命令

 我来答
huanglenzhi
2018-01-25 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
采纳数:117538 获赞数:517174
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。

向TA提问 私信TA
展开全部
1、用jps命令
(1)master节点
启动集群:
cy@master:~$ start-all.sh
starting namenode, logging to /home/cy/Hadoop/hadoop-1.2.1/libexec/../logs/hadoop-cy-namenode-master.out
slave2: starting datanode, logging to /home/cy/Hadoop/hadoop-1.2.1/libexec/../logs/hadoop-cy-datanode-slave2.out
slave1: starting datanode, logging to /home/cy/Hadoop/hadoop-1.2.1/libexec/../logs/hadoop-cy-datanode-slave1.out
master: starting secondarynamenode, logging to /home/cy/Hadoop/hadoop-1.2.1/libexec/../logs/hadoop-cy-secondarynamenode-master.out
starting jobtracker, logging to /home/cy/Hadoop/hadoop-1.2.1/libexec/../logs/hadoop-cy-jobtracker-master.out
slave1: starting tasktracker, logging to /home/cy/Hadoop/hadoop-1.2.1/libexec/../logs/hadoop-cy-tasktracker-slave1.out
slave2: starting tasktracker, logging to /home/cy/Hadoop/hadoop-1.2.1/libexec/../logs/hadoop-cy-tasktracker-slave2.out

用jps命令查看Java进程:
cy@master:~$ jps
6670 NameNode
7141 Jps
7057 JobTracker

(2)slave1节点

用jps命令查看Java进程:

cy@slave1:~$ jps
3218 Jps
2805 DataNode
2995 TaskTracker

(3)slave2节点

用jps命令查看Java进程:

cy@slave2:~$ jps
2913 TaskTracker
2731 DataNode
3147 Jps
如果三台虚拟机用jps命令查询时如上面显示的那样子,就说明hadoop安装和配置成功了。

2、hadoop集群的测试,用hadoop-examples-1.2.1.jar中自带的wordcount程序进行测试,该程序的作用是统计单词的个数。
(1)我们现在桌面上创建一个新的文件test.txt,里面总共有10行,每行都是hello world
(2)在HDFS系统里创建一个input文件夹,使用命令如下:
hadoop fs -mkdir input
或 hadoop fs -mkdir /user/你的用户名/input
(3)把创建好的test.txt上传到HDFS系统的input文件夹下,使用命令如下所示。
hadoop fs -put /home/你的用户名/桌面/test.txt input
或 hadoop fs -put /home/你的用户名/桌面/test.txt /user/你的用户名/input
(4)我们可以查看test.txt是否在HDFS的input文件夹下,如下所示:
hadoop fs -ls input
如果显示如下就说明上传成功:
Found 1 items
-rw-r--r-- 3 cy supergroup 120 2015-05-08 20:26 /user/cy/input/test.txt

(5)执行hadoop-examples-1.2.1.jar中自带的wordcount程序,如下:(提示:在执行下面的命令之前,你要在终端用cd命令进入到/home/cy/Hadoop/hadoop-1.2.1目录)
hadoop jar hadoop-examples-1.2.1.jar wordcount /user/你的用户名/input/test.txt /user/你的用户名/output

如果显示如下结果就说明运行成功:
15/05/08 20:31:29 INFO input.FileInputFormat: Total input paths to process : 1
15/05/08 20:31:29 INFO util.NativeCodeLoader: Loaded the native-hadoop library
15/05/08 20:31:29 WARN snappy.LoadSnappy: Snappy native library not loaded
15/05/08 20:31:30 INFO mapred.JobClient: Running job: job_201505082010_0001
15/05/08 20:31:31 INFO mapred.JobClient: map 0% reduce 0%
15/05/08 20:31:35 INFO mapred.JobClient: map 100% reduce 0%
15/05/08 20:31:42 INFO mapred.JobClient: map 100% reduce 33%
15/05/08 20:31:43 INFO mapred.JobClient: map 100% reduce 100%
15/05/08 20:31:43 INFO mapred.JobClient: Job complete: job_201505082010_0001
15/05/08 20:31:43 INFO mapred.JobClient: Counters: 29
15/05/08 20:31:43 INFO mapred.JobClient: Job Counters
15/05/08 20:31:43 INFO mapred.JobClient: Launched reduce tasks=1
15/05/08 20:31:43 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=3117
15/05/08 20:31:43 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
15/05/08 20:31:43 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
15/05/08 20:31:43 INFO mapred.JobClient: Launched map tasks=1
15/05/08 20:31:43 INFO mapred.JobClient: Data-local map tasks=1
15/05/08 20:31:43 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=8014
15/05/08 20:31:43 INFO mapred.JobClient: File Output Format Counters
15/05/08 20:31:43 INFO mapred.JobClient: Bytes Written=18
15/05/08 20:31:43 INFO mapred.JobClient: FileSystemCounters
15/05/08 20:31:43 INFO mapred.JobClient: FILE_BYTES_READ=30
15/05/08 20:31:43 INFO mapred.JobClient: HDFS_BYTES_READ=226
15/05/08 20:31:43 INFO mapred.JobClient: FILE_BYTES_WRITTEN=116774
15/05/08 20:31:43 INFO mapred.JobClient: HDFS_BYTES_WRITTEN=18
15/05/08 20:31:43 INFO mapred.JobClient: File Input Format Counters
15/05/08 20:31:43 INFO mapred.JobClient: Bytes Read=120
15/05/08 20:31:43 INFO mapred.JobClient: Map-Reduce Framework
15/05/08 20:31:43 INFO mapred.JobClient: Map output materialized bytes=30
15/05/08 20:31:43 INFO mapred.JobClient: Map input records=10
15/05/08 20:31:43 INFO mapred.JobClient: Reduce shuffle bytes=30
15/05/08 20:31:43 INFO mapred.JobClient: Spilled Records=4
15/05/08 20:31:43 INFO mapred.JobClient: Map output bytes=200
15/05/08 20:31:43 INFO mapred.JobClient: CPU time spent (ms)=610
15/05/08 20:31:43 INFO mapred.JobClient: Total committed heap usage (bytes)=176427008
15/05/08 20:31:43 INFO mapred.JobClient: Combine input records=20
15/05/08 20:31:43 INFO mapred.JobClient: SPLIT_RAW_BYTES=106
15/05/08 20:31:43 INFO mapred.JobClient: Reduce input records=2
15/05/08 20:31:43 INFO mapred.JobClient: Reduce input groups=2
15/05/08 20:31:43 INFO mapred.JobClient: Combine output records=2
15/05/08 20:31:43 INFO mapred.JobClient: Physical memory (bytes) snapshot=182902784
15/05/08 20:31:43 INFO mapred.JobClient: Reduce output records=2
15/05/08 20:31:43 INFO mapred.JobClient: Virtual memory (bytes) snapshot=756301824
15/05/08 20:31:43 INFO mapred.JobClient: Map output records=20
(6)我们可以使用下面的命令还查看运行后的结果:
hadoop fs -ls output
hadoop fs -text /user/你的用户名/output/part-r-00000
如果显示如下就说明hadoop三个节点安装和配置成功,测试也成功了,就可以继续更深入地使用和研究hadoop了
hello 10
world 10
千锋教育
2018-07-26 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
展开全部
1、首先启动hadoop集群,查看你的进程是否都启动起来

3884 Jps
1776 ResourceManager
1613 SecondaryNameNode
1872 NodeManager
1467 DataNode
1377 NameNode
2、然后创建一个目录,比如 /djt ,然后上传一个文件djt.txt到该目录下
如果上面步骤都正常,代表hadoop伪分布集群安装成功!
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式