Linux下部署Hadoop伪分布模式

Hadoop版本为1.2.1

  Linux使用Fedora19并使用hadoop账号安装

  第一步:配置ssh本地登录证书(虽然为伪分布模式,Hadoop依然会使用SSH进行通信)


[hadoop@promote ~]$ which ssh

/usr/bin/ssh

[hadoop@promote ~]$ which ssh-keygen

/usr/bin/ssh-keygen

[hadoop@promote ~]$ which sshd

/usr/sbin/sshd

[hadoop@promote ~]$ ssh-keygen -t rsa

  然后一路回车


Generating public/private rsa key pair.

Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):

Created directory '/home/hadoop/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Passphrases do not match.  Try again.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/hadoop/.ssh/id_rsa.

Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.

The key fingerprint is:

2f:a9:60:c7:dc:38:8f:c7:bb:70:de:d4:39:c3:39:87 hadoop@promote.cache-dns.local

The key's randomart image is:

+--[ RSA 2048]----+

|                 |

|                 |

|                 |

|                 |

|        S        |

|     o o o o +   |

|    o B.= o E .  |

|   . o Oo+   =   |

|      o.=o.      |

+-----------------+

  最终将在/home/hadoop/.ssh/路径下生成私钥id_rsa和公钥id_rsa.pub

  [hadoop@promote .ssh]$ cd /home/hadoop/.ssh/

  [hadoop@promote .ssh]$ ls

  id_rsa  id_rsa.pub

  修改sshd服务配置文件:

  [hadoop@promote .ssh]$ su root

  密码:

  [root@promote .ssh]# vi /etc/ssh/sshd_config

  启用RSA加密算法验证(去掉前面的#号)


RSAAuthentication yes

PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2

# but this is overridden so installations will only check .ssh/authorized_keys

AuthorizedKeysFile      .ssh/authorized_keys

 修改mapred-site.xml:


<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

<property>

<name>mapred.job.tracker</name>

<value>localhost:9001</value>

</property>

</configuration>

  修改hdfs-site.xml:


<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

<property>

<name>dfs.replication</name>

<value>1</value>

</property>

</configuration>

  master中指定的SNN节点和slaves中指定的从节点位置均为本地


[hadoop@promote conf]$ cat masters

localhost

[hadoop@promote conf]$ cat slaves

localhost

  第五步:启动Hadoop


[hadoop@promote bin]$ cd ../conf/

[hadoop@promote conf]$ cd ../bin

[hadoop@promote bin]$ sh start-all.sh

starting namenode, logging to /home/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-hadoop-namenode-promote.cache-dns.local.out

localhost: starting datanode, logging to /home/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-hadoop-datanode-promote.cache-dns.local.out

localhost: starting secondarynamenode, logging to /home/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-hadoop-secondarynamenode-promote.cache-dns.local.out

starting jobtracker, logging to /home/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-hadoop-jobtracker-promote.cache-dns.local.out

localhost: starting tasktracker, logging to /home/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-hadoop-tasktracker-promote.cache-dns.local.out

  可以看到所有Hadoop守护进程均已启动

 保存并退出,然后重启sshd服务


[root@promote .ssh]# service sshd restart

Redirecting to /bin/systemctl restart  sshd.service

[root@promote .ssh]# ps -ef|grep sshd

root      1995     1  0 22:33 ?        00:00:00 sshd: hadoop [priv]

hadoop    2009  1995  0 22:33 ?        00:00:00 sshd: hadoop@pts/0

root      4171     1  0 23:11 ?        00:00:00 /usr/sbin/sshd -D

root      4175  3397  0 23:12 pts/0    00:00:00 grep --color=auto sshd

  然后切换回hadoop用户,将ssh证书公钥拷贝至/home/hadoop/.ssh/authorized_keys文件中

  [root@promote .ssh]# su hadoop

  [hadoop@promote .ssh]$ cat id_rsa.pub >> authorized_keys

  修改authorized_keys文件的权限为644(这步一定要有)

  [hadoop@promote .ssh]$ chmod 644 authorized_keys

  [hadoop@promote .ssh]$ ssh localhost

  The authenticity of host 'localhost (127.0.0.1)' can't be established.

  RSA key fingerprint is 25:1f:be:72:7b:83:8e:c7:96:b6:71:35:fc:5d:2e:7d.

  Are you sure you want to continue connecting (yes/no)? yes

  Warning: Permanently added 'localhost' (RSA) to the list of known hosts.

  Last login: Thu Feb 13 23:42:43 2014

  第一次登陆将会将证书内容保存在/home/hadoop/.ssh/known_hosts文件中,以后再次登陆将不需要输入密码

  [hadoop@promote .ssh]$ ssh localhost

  Last login: Thu Feb 13 23:46:04 2014 from localhost.localdomain

  至此ssh证书部分配置完成

  第二步:安装JDK

  [hadoop@promote ~]$ java -version

  java version "1.7.0_25"

  OpenJDK Runtime Environment (fedora-2.3.10.3.fc19-i386)

  OpenJDK Client VM (build 23.7-b01, mixed mode)

  将OpenJDK换为Oracle的Java SE

  [hadoop@promote .ssh]$ cd ~

  [hadoop@promote ~]$ uname -i

  i386

  在Oracle的官网下载jdk-6u45-linux-i586.bin后上传至服务器,赋予权限并进行安装,最后删除安装包

  [hadoop@promote ~]$ chmod u+x jdk-6u45-linux-i586.bin

  [hadoop@promote ~]$ ./jdk-6u45-linux-i586.bin

  [hadoop@promote ~]$ rm -rf jdk-6u45-linux-i586.bin

  [hadoop@promote conf]$ export PATH=$PATH:/home/hadoop/jdk1.6.0_45/bin

  出现以下结果说明JDK成功安装:

  [hadoop@promote ~]$ java -version

  java version "1.6.0_45"

  Java(TM) SE Runtime Environment (build 1.6.0_45-b06)

  Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)

  第三步:安装Hadoop

  在Hadoop官网下载hadoop-1.2.1.tar.gz并上传至服务器/home/hadoop路径下

  [hadoop@promote ~]$ tar -xzf hadoop-1.2.1.tar.gz

  [hadoop@promote ~]$ rm -rf hadoop-1.2.1.tar.gz

  [hadoop@promote ~]$ cd hadoop-1.2.1/conf/

  [hadoop@promote conf]$ vi hadoop-env.sh

  将JAVA_HOME指向第二步安装的JDK所在目录片

  # The java implementation to use.  Required.

  export JAVA_HOME=/home/hadoop/jdk1.6.0_45

  保存并退出

  第四步:修改Hadoop配置文件

  修改core-site.xml:


<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

<property>

<name>fs.default.name</name>

<value>hdfs://localhost:9000</value>

</property>

</configuration>

最新内容请见作者的GitHub页:http://qaseven.github.io/

时间: 2025-01-21 00:25:59

Linux下部署Hadoop伪分布模式的相关文章

Hadoop大象之旅007-配置Hadoop伪分布模式

Hadoop大象之旅007-配置Hadoop伪分布模式                                                          老帅    安装hadoop分为本地模式.伪分布模式.集群模式.本地模式是运行在本地,只负责存储,没有计算功能.伪分布模式是在一台机器上模拟分布式部署,方便学习和调试.集群模式是在多个机器上配置hadoop,是真正的"分布式".    伪分布模式是在一台单机上运行,但用不同的 Java 进程模仿分布式运行中的各类结点

Spark教程-构建Spark集群-配置Hadoop伪分布模式并运行Wordcount示例(1)

&http://www.aliyun.com/zixun/aggregation/37954.html">nbsp;   伪分布模式主要涉及一下的配置信息: 修改Hadoop的核心配置文件core-site.xml,主要是配置HDFS的地址和端口号: 修改Hadoop中HDFS的配置文件hdfs-site.xml,主要是配置replication; 修改Hadoop的MapReduce的配置文件mapred-site.xml,主要是配置JobTracker的地址和端口: 在具体操作

linux下部署goagent

下载以下两个软件 1.Google App Engine SDK for Python https://developers.google.com/appengine/downloads?hl=zh-CN#Google_App_Engine_SDK_for_Python 2.goagent https://code.google.com/p/goagent/ 在此提供已经包含goagent的google appengine压缩包 http://pan.baidu.com/share/link?s

win linux 下 部署war包到Tomcat根目录

在WIN系统下: 在TOMCAT中部署war  1.将war文件拷贝到tomcat目录\webapps\ 下.  2.将必要的jar文件拷贝到tomcat目录\lib\ 下.  3.修改tomcat目录\conf\下的server.xml.  <!-- Tomcat Manager Context --> <Context path="/manager" docBase="manager" debug="0"privileged

Linux 下部署activeMQ报错。

问题描述 activeMQ和spring结合使用,配置文件如下:<?xmlversion="1.0"encoding="UTF-8"?><!--LicensedtotheApacheSoftwareFoundation(ASF)underoneormorecontributorlicenseagreements.SeetheNOTICEfiledistributedwiththisworkforadditionalinformationregard

Linux下部署ali cobar server

1,cobar项目 官方网站,已经迁移到github上面了. https://github.com/alibaba/cobar 下载: https://github.com/alibaba/cobar/wiki/%E4%B8%8B%E8%BD%BD Cobar是关系型数据的分布式处理系统,它可以在分布式的环境下看上去像传统数据库一样为您提供海量数据服 务. 2,Cobar解决的问题 分布式:Cobar的分布式主要是通过将表放入不同的库来实现: 1. Cobar支持将一张表水平拆分成多份分别放入不

linux 下部署 java quartz job

1. 首先写好你的 java quartz job, 然后用 Eclipse 把它导出成 runnable jar  2. 编写 shell 脚本' #!/bin/sh # chkconfig: 23456 80 10 # description: check pnr export SERVER=/usr/job/ cd $SERVER case "$1" in start) nohup java -server -jar ZeusService.jar zeus.quartz.air

linux-在Linux部署hadoop,启动出错

问题描述 在Linux部署hadoop,启动出错 启动时整个输出很多信息,正常情况下,应该只有几行,启动了namenode.datanode等, 但是我在启动的时候却一直报'ssh: Could not resolve hostname ' 具体信息如下: [root@hbase ~]# start-dfs.sh with: ssh: Could not resolve hostname with: Temporary failure in name resolution it: ssh: Co

[Hadoop系列]Hadoop的安装-2.伪分布模式

inkfish原创,请勿商业性质转载,转载请注明来源(http://blog.csdn.net/inkfish ). Hadoop是Apache基金会下的一个开源云计算平台项目.当前最新版本是hadoop 0.20.1.下面就hadoop 0.20.1为蓝本,介绍在Ubuntu Linux 9.10下安装hadoop的方法.(来源:http://blog.csdn.net/inkfish) 支持的平台:(来源:http://blog.csdn.net/inkfish) Linux,可作为开发和产